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

50% Statements 5/10
100% Branches 0/0
37.5% Functions 3/8
50% Lines 5/10

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            2x   11x 11x       4x       4x                                              
import type * as misc from 'memfs/lib/node/types/misc';
import {Nfsv4FType} from '../constants';
 
/**
 * Implements Node.js-like Dirent interface for NFS v4 directory entries.
 */
export class NfsFsDirent implements misc.IDirent {
  constructor(
    public name: string,
    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;
  }
}