1 | 'use strict'
|
2 |
|
3 | const path = require('path')
|
4 |
|
5 |
|
6 |
|
7 |
|
8 | class File {
|
9 | constructor (path, mtime, doNotCache, type, isBinary) {
|
10 |
|
11 | this.path = path
|
12 |
|
13 |
|
14 | this.originalPath = path
|
15 |
|
16 |
|
17 | this.contentPath = path
|
18 |
|
19 |
|
20 |
|
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 |
|
31 | this.isBinary = isBinary === undefined ? null : isBinary
|
32 | }
|
33 |
|
34 | |
35 |
|
36 |
|
37 |
|
38 | detectType () {
|
39 | return path.extname(this.path).substring(1)
|
40 | }
|
41 |
|
42 | toString () {
|
43 | return this.path
|
44 | }
|
45 | }
|
46 |
|
47 | module.exports = File
|