Skip to content
This repository was archived by the owner on Dec 12, 2021. It is now read-only.

Commit c96cd26

Browse files
committed
Added option for file deletion in storage class
1 parent c51e1fd commit c96cd26

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lib/storage.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,12 @@ export default class Storage {
6060
return fs.readFileSync(this.storageDir+this.dir+snippetTitle.split(' ').join('-')+'.snippet.json');
6161
}
6262
}
63+
64+
deleteFile(snippetTitle) {
65+
if(fs.existsSync(this.storageDir+this.dir+snippetTitle.split(' ').join('-')+'.snippet.json')) {
66+
return fs.unlinkSync(this.storageDir+this.dir+snippetTitle.split(' ').join('-')+'.snippet.json');
67+
} else {
68+
return false;
69+
}
70+
}
6371
}

0 commit comments

Comments
 (0)