All files / src/filesystem node.js

100% Statements 11/11
91.67% Branches 11/12
100% Functions 1/1
100% Lines 11/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              84x   84x 84x 84x 84x 84x 84x 84x 84x 84x 84x      
// base file (or dir) node
// not sure what else should we keep here
 
import MODE from './mode'
 
export default class Node {
  constructor (path, mode, size, flags, data, atime, ctime, mtime) {
    const now = Date.now()
 
    this.path = path
    this.mode = mode || MODE.FILE
    this.size = size || 0
    this.flags = flags || {}
    this.atime = atime || now
    this.ctime = ctime || now
    this.mtime = mtime || now
    this.blksize = undefined
    this.nblocks = 1
    this.data = data // blob, arraybuffer, text, you name it
  }
}