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

54.54% Statements 6/11
100% Branches 0/0
37.5% Functions 3/8
54.54% Lines 6/11

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