source: trip-planner-front/node_modules/karma/lib/file.js@ 6a3a178

Last change on this file since 6a3a178 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 1.1 KB
Line 
1'use strict'
2
3const path = require('path')
4
5/**
6 * File object used for tracking files in `file-list.js`.
7 */
8class File {
9 constructor (path, mtime, doNotCache, type, isBinary) {
10 // used for serving (processed path, eg some/file.coffee -> some/file.coffee.js)
11 this.path = path
12
13 // original absolute path, id of the file
14 this.originalPath = path
15
16 // where the content is stored (processed)
17 this.contentPath = path
18
19 // encodings format {[encodingType]: encodedContent}
20 // example: {gzip: <Buffer 1f 8b 08...>}
21 this.encodings = Object.create(null)
22
23 this.mtime = mtime
24 this.isUrl = false
25
26 this.doNotCache = doNotCache === undefined ? false : doNotCache
27
28 this.type = type
29
30 // Tri state: null means probe file for binary.
31 this.isBinary = isBinary === undefined ? null : isBinary
32 }
33
34 /**
35 * Detect type from the file extension.
36 * @returns {string} detected file type or empty string
37 */
38 detectType () {
39 return path.extname(this.path).substring(1)
40 }
41
42 toString () {
43 return this.path
44 }
45}
46
47module.exports = File
Note: See TracBrowser for help on using the repository browser.