Add Attachments.deleteData
This commit is contained in:
parent
9b636a1885
commit
10afcf1bb0
2 changed files with 43 additions and 0 deletions
|
@ -67,6 +67,22 @@ exports.writeData = (root) => {
|
|||
};
|
||||
};
|
||||
|
||||
// deleteData :: AttachmentsPath -> IO Unit
|
||||
exports.deleteData = (root) => {
|
||||
if (!isString(root)) {
|
||||
throw new TypeError('`root` must be a path');
|
||||
}
|
||||
|
||||
return async (relativePath) => {
|
||||
if (!isString(relativePath)) {
|
||||
throw new TypeError('`relativePath` must be a string');
|
||||
}
|
||||
|
||||
const absolutePath = path.join(root, relativePath);
|
||||
await fse.remove(absolutePath);
|
||||
};
|
||||
};
|
||||
|
||||
// createName :: Unit -> IO String
|
||||
exports.createName = () => {
|
||||
const buffer = crypto.randomBytes(32);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue