-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
49dfb88
commit 8bf9b09
Showing
33 changed files
with
220 additions
and
133 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
const FSLock = require('./src/FSLock/FSLock') | ||
const Directory = require('./src/Directory/Directory') | ||
const File = require('./src/File/File') | ||
module.exports = { | ||
FSLock, File, Directory | ||
} | ||
import FSLock from './src/FSLock/FSLock.js'; | ||
import Directory from './src/Directory/Directory.js'; | ||
import File from './src/File/File.js'; | ||
|
||
export {FSLock, File, Directory}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,14 @@ | ||
import create from './methods/create.js'; | ||
import exists from './methods/exists.js'; | ||
import ensure from './methods/ensure.js'; | ||
import list from './methods/list.js'; | ||
import remove from './methods/remove.js'; | ||
|
||
const Directory = {}; | ||
Directory.create = require('./methods/create').bind(Directory); | ||
Directory.exists = require('./methods/exists').bind(Directory); | ||
Directory.ensure = require('./methods/ensure').bind(Directory); | ||
Directory.list = require('./methods/list').bind(Directory); | ||
Directory.remove = require('./methods/remove').bind(Directory); | ||
module.exports = Directory; | ||
|
||
Directory.create = create.bind(Directory); | ||
Directory.exists = exists.bind(Directory); | ||
Directory.ensure = ensure.bind(Directory); | ||
Directory.list = list.bind(Directory); | ||
Directory.remove = remove.bind(Directory); | ||
export default Directory; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,10 @@ | ||
const Job = require('../../Job/Job'); | ||
module.exports = function add(command, path, params){ | ||
import Job from '../../Job/Job.js'; | ||
|
||
function add(command, path, params){ | ||
const job = new Job({command, path, params}); | ||
this.queue.push(job); | ||
job.state = 'queued'; | ||
return job; | ||
} | ||
|
||
export default add; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
module.exports = function get(index = 0) { | ||
function get(index = 0) { | ||
return this.queue[index]; | ||
} | ||
|
||
export default get; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
module.exports = function stop() { | ||
function stop() { | ||
if(!this.autoExecStarted) return false; | ||
this.autoExecStarted = false; | ||
} | ||
|
||
export default stop; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,22 @@ | ||
const File = {}; | ||
File.append = require('./methods/append').bind(File); | ||
File.appendJSON = require('./methods/appendJSON').bind(File); | ||
File.create = require('./methods/create').bind(File); | ||
File.download = require('./methods/download').bind(File); | ||
File.exists = require('./methods/exists').bind(File); | ||
File.ensure = require('./methods/ensure').bind(File); | ||
File.read = require('./methods/read').bind(File); | ||
File.remove = require('./methods/remove').bind(File); | ||
module.exports = File; | ||
|
||
import append from "./methods/append.js"; | ||
import appendJSON from "./methods/appendJSON.js"; | ||
import create from "./methods/create.js"; | ||
import download from "./methods/download.js"; | ||
import exists from "./methods/exists.js"; | ||
import ensure from "./methods/ensure.js"; | ||
import read from "./methods/read.js"; | ||
import remove from "./methods/remove.js"; | ||
|
||
File.append = append.bind(File); | ||
File.appendJSON = appendJSON.bind(File); | ||
File.create = create.bind(File); | ||
File.download = download.bind(File); | ||
File.exists = exists.bind(File); | ||
File.ensure = ensure.bind(File); | ||
File.read = read.bind(File); | ||
File.remove = remove.bind(File); | ||
|
||
|
||
export default File; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
const fs = require('fs'); | ||
module.exports = async function append(p) { | ||
import fs from 'fs'; | ||
async function append(p) { | ||
return new Promise((res, rej) => { | ||
fs.appendFile(p, data, (err) => { | ||
if (err) rej(err); | ||
res(true); | ||
}); | ||
}); | ||
} | ||
export default append; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,14 @@ | ||
module.exports = async function append(p, data = {}) { | ||
async function appendJSON(p, data = {}) { | ||
const self = this; | ||
|
||
return new Promise(async (resolve, reject) => { | ||
let json = {}; | ||
if (await this.exists(p)) { | ||
json = await this.read(p); | ||
if (await self.exists(p)) { | ||
json = await self.read(p); | ||
} | ||
const res = await this.create(p, Object.assign({}, json, data)); | ||
const res = await self.create(p, Object.assign({}, json, data)); | ||
resolve(res) | ||
}); | ||
} | ||
|
||
export default appendJSON; |
Oops, something went wrong.