UNPKG

878 BJavaScriptView Raw
1'use strict'
2
3/**
4 * File object used for tracking files in `file-list.js`.
5 */
6class File {
7 constructor (path, mtime, doNotCache, type, isBinary) {
8 // used for serving (processed path, eg some/file.coffee -> some/file.coffee.js)
9 this.path = path
10
11 // original absolute path, id of the file
12 this.originalPath = path
13
14 // where the content is stored (processed)
15 this.contentPath = path
16
17 // encodings format {[encodingType]: encodedContent}
18 // example: {gzip: <Buffer 1f 8b 08...>}
19 this.encodings = Object.create(null)
20
21 this.mtime = mtime
22 this.isUrl = false
23
24 this.doNotCache = doNotCache === undefined ? false : doNotCache
25
26 this.type = type
27
28 // Tri state: null means probe file for binary.
29 this.isBinary = isBinary === undefined ? null : isBinary
30 }
31
32 toString () {
33 return this.path
34 }
35}
36
37module.exports = File