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:
419 bytes
|
Line | |
---|
1 | 'use strict'
|
---|
2 |
|
---|
3 | const fs = require('graceful-fs')
|
---|
4 |
|
---|
5 | const FileUtils = {
|
---|
6 | readFile (path) {
|
---|
7 | return fs.readFileSync(path).toString()
|
---|
8 | },
|
---|
9 |
|
---|
10 | saveFile (path, content) {
|
---|
11 | fs.writeFileSync(path, content)
|
---|
12 | },
|
---|
13 |
|
---|
14 | copyFile (src, dest) {
|
---|
15 | FileUtils.saveFile(dest, FileUtils.readFile(src))
|
---|
16 | },
|
---|
17 |
|
---|
18 | removeFileIfExists (src) {
|
---|
19 | if (fs.existsSync(src)) {
|
---|
20 | fs.unlinkSync(src)
|
---|
21 | }
|
---|
22 | }
|
---|
23 | }
|
---|
24 |
|
---|
25 | module.exports = FileUtils
|
---|
Note:
See
TracBrowser
for help on using the repository browser.