This file contains hidden or 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
const fs = require('fs'); | |
const archiver = require('archiver'); | |
const path = require('path'); | |
// inspired from https://stackoverflow.com/questions/15641243/need-to-zip-an-entire-directory-using-node-js | |
const zipDirectory = (dirPath, outputFile = "target.zip") => { | |
const dPath = path.resolve(dirPath); | |
var output = fs.createWriteStream(outputFile); | |
const archive = archiver('zip'); |
This file contains hidden or 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
const { default: axios } = require("axios"); | |
const fs = require("fs"); | |
const downloadFile = async (url, filename) => { | |
const { data, headers, request } = await axios({ | |
url: url, | |
method: "GET", | |
responseType: "stream", | |
}); |
This file contains hidden or 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
// https://dev.to/stackfindover/how-to-integrate-webcam-using-javascript-3fji | |
var StopWebCam = function () { | |
var stream = video.srcObject; | |
var tracks = stream.getTracks(); | |
for (var i = 0; i < tracks.length; i++) { | |
var track = tracks[i]; | |
track.stop(); | |
} |
This file contains hidden or 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
# https://dev.to/trilon/how-to-delete-all-nodemodules-folders-on-your-machine-43dh | |
$ cd documents | |
$ find . -name 'node_modules' -type d -prune -print -exec rm -rf '{}' \; |
This file contains hidden or 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
const fs = require('fs'); | |
// SOURCE: https://dev.to/leonard/get-files-recursive-with-the-node-js-file-system-fs-2n7o | |
const FileService = { | |
getAllFiles: async (path = "./") => { | |
const entries = await fs.readdirSync(path, { | |
withFileTypes: true | |
}); |
This file contains hidden or 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
const fs = require('fs'); | |
const path = require('path'); | |
const HOME_PATH = "I:\\dl"; | |
const HOME_FOLDER = path.resolve(HOME_PATH); | |
const files = fs.readdirSync(HOME_FOLDER, 'utf-8'); | |
console.log(files); |
This file contains hidden or 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
const fs = require('fs'); | |
const path = require('path'); | |
const HOME_PATH = "H:\\English\\1080p-hevc"; | |
const HOME_FOLDER = path.resolve(HOME_PATH); | |
const files = fs.readdirSync(HOME_FOLDER, 'utf-8'); | |
console.log(files); |
This file contains hidden or 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
const renameFile = (folderPath, strToRemove) => { | |
const fs = require('fs'); | |
const path = require('path'); | |
const files = fs.readdirSync(folderPath,'utf-8'); | |
files.forEach(v => { | |
if(v.indexOf(strToRemove) !== -1){ | |
let newName = v.replace(strToRemove, ""); |
This file contains hidden or 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
const fs = require('fs'); | |
const path = require('path'); | |
// settings. | |
const CONF = { | |
HOME_PATH : "/Volumes/SYMC/movies/2-hindi/2-hindi-hevc" | |
} |
This file contains hidden or 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
const fs = require('fs'); | |
const path = require('path'); | |
const HOME_PATH = "/Users/senthilmpro/Desktop/test"; | |
const HOME_FOLDER = path.resolve(HOME_PATH); | |
const files = fs.readdirSync(HOME_FOLDER, 'utf-8'); | |
console.log(files); |