Add worker.remove()
This commit is contained in:
parent
fbdc691184
commit
dbcb56b55c
@ -85,6 +85,12 @@ module.exports = (_options = {}) => {
|
|||||||
}))
|
}))
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const remove = (path, jobId) => (
|
||||||
|
startJob(createJob({
|
||||||
|
id: jobId, action: 'remove', payload: { path },
|
||||||
|
}))
|
||||||
|
);
|
||||||
|
|
||||||
const run = (args, jobId) => (
|
const run = (args, jobId) => (
|
||||||
startJob(createJob({
|
startJob(createJob({
|
||||||
id: jobId, action: 'run', payload: { args },
|
id: jobId, action: 'run', payload: { args },
|
||||||
@ -132,6 +138,7 @@ module.exports = (_options = {}) => {
|
|||||||
write,
|
write,
|
||||||
transcode,
|
transcode,
|
||||||
read,
|
read,
|
||||||
|
remove,
|
||||||
run,
|
run,
|
||||||
terminate,
|
terminate,
|
||||||
};
|
};
|
||||||
|
@ -80,6 +80,15 @@ const read = ({
|
|||||||
res.resolve(Module.FS.readFile(path));
|
res.resolve(Module.FS.readFile(path));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const remove = ({
|
||||||
|
payload: {
|
||||||
|
path,
|
||||||
|
},
|
||||||
|
}, res) => {
|
||||||
|
Module.FS.unlink(path);
|
||||||
|
res.resolve({ message: `Delete ${path}` });
|
||||||
|
};
|
||||||
|
|
||||||
const run = ({
|
const run = ({
|
||||||
payload: {
|
payload: {
|
||||||
args,
|
args,
|
||||||
@ -108,6 +117,7 @@ exports.dispatchHandlers = (packet, send) => {
|
|||||||
write,
|
write,
|
||||||
transcode,
|
transcode,
|
||||||
read,
|
read,
|
||||||
|
remove,
|
||||||
run,
|
run,
|
||||||
})[packet.action](packet, res);
|
})[packet.action](packet, res);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
Loading…
Reference in New Issue
Block a user