file.js 754 B

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