What do you want to save?
Add Code snippet
New code examples
-
Javascript 2021-10-28 00:30:13
express delete image
const router = express.Router(); const path = require("path"); const fs = require('fs'); var multer = require('multer') var upload = multer({ dest: 'uploads/' }) router.get('/:folder/:id', async (req, res) => { let filepath = path.join(_... Add solution -
Javascript 2021-10-16 18:07:05
delete all files in a folder with nodejs
rmDir = function(dirPath, removeSelf) { try { var files = fs.readdirSync(dirPath); } catch(e) { return; } if (files.length > 0) for (var i = 0; i < files.length; i++) { var filePath = dirPath + '/' + files[i]; if (fs.statSync(f... Add solution -
Javascript 2021-10-16 15:23:10
How to Upload Files to a Node.js Server
/* This code comes from Vincent Lab And it has a video version linked here: https://www.youtube.com/watch?v=KP_8gN8kh4Y */ // Import dependencies const fs = require("fs"); const YAML = require("js-yaml"); const express = requi... Add solution -
TypeScript 2021-09-15 15:00:03
delete attachments in nodejs
// NOTE: `file_name` values are obfuscated and uniquely generated by the client. // The actual file name is in data storage. app.post('/delete/:file_name', (req, res) => { const theFile = 'attachments/' + req.params.file_name; var resultHandle... Add solution
Best helpers
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5