You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
641 B
35 lines
641 B
'use strict'; |
|
|
|
const { readFile, readFileSync, stat, statSync } = require('hexo-fs'); |
|
|
|
class File { |
|
constructor({ source, path, params, type }) { |
|
this.source = source; |
|
this.path = path; |
|
this.params = params; |
|
this.type = type; |
|
} |
|
|
|
read(options) { |
|
return readFile(this.source, options); |
|
} |
|
|
|
readSync(options) { |
|
return readFileSync(this.source, options); |
|
} |
|
|
|
stat(options) { |
|
return stat(this.source); |
|
} |
|
|
|
statSync(options) { |
|
return statSync(this.source); |
|
} |
|
} |
|
|
|
File.TYPE_CREATE = 'create'; |
|
File.TYPE_UPDATE = 'update'; |
|
File.TYPE_SKIP = 'skip'; |
|
File.TYPE_DELETE = 'delete'; |
|
|
|
module.exports = File;
|
|
|