All files / json-pack/src/nfs/v4/client NfsFsStats.ts

85.18% Statements 23/27
100% Branches 0/0
50% Functions 4/8
85.18% Lines 23/27

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58            2x   37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x       14x       8x                       3x                      
import type * as misc from 'memfs/lib/node/types/misc';
import {Nfsv4FType} from '../constants';
 
/**
 * Implements Node.js-like Stats interface for NFS v4 file attributes.
 */
export class NfsFsStats implements misc.IStats<number> {
  constructor(
    public uid: number,
    public gid: number,
    public rdev: number,
    public blksize: number,
    public ino: number,
    public size: number,
    public blocks: number,
    public atime: Date,
    public mtime: Date,
    public ctime: Date,
    public birthtime: Date,
    public atimeMs: number,
    public mtimeMs: number,
    public ctimeMs: number,
    public birthtimeMs: number,
    public dev: number,
    public mode: number,
    public nlink: number,
    private type: Nfsv4FType,
  ) {}
 
  isDirectory(): boolean {
    return this.type === Nfsv4FType.NF4DIR;
  }
 
  isFile(): boolean {
    return this.type === Nfsv4FType.NF4REG;
  }
 
  isBlockDevice(): boolean {
    return this.type === Nfsv4FType.NF4BLK;
  }
 
  isCharacterDevice(): boolean {
    return this.type === Nfsv4FType.NF4CHR;
  }
 
  isSymbolicLink(): boolean {
    return this.type === Nfsv4FType.NF4LNK;
  }
 
  isFIFO(): boolean {
    return this.type === Nfsv4FType.NF4FIFO;
  }
 
  isSocket(): boolean {
    return this.type === Nfsv4FType.NF4SOCK;
  }
}