All Questions
Tagged with file-system javascript
21 questions
2
votes
1
answer
129
views
Safely renaming/moving files in Node (cross platform)
My goal is to create a function that safely renames files by adding numeric increments if the file is found at the destination, without using a third party library.
Having a source file ...
3
votes
1
answer
224
views
NodeJS CLI script to create React apps
Background
I crated a CLI tool which executes an npm command (to create a react app) and modifies the contents of the generated files. It was a practice attempt at ...
3
votes
2
answers
199
views
Reading image files asynchronously and displaying them on the page
I am trying to display images from a folder in my project using the "fs" module with NodeJS. I need to read all images in a directory and run them in a loop for them to be displayed. I was able to do ...
4
votes
2
answers
184
views
Static site generator using JavaScript Promises
I have created a small static site generator (for learning purposes) in Javascript ES6, using Promises, but I am not certain of how to use them well. The code below works fine, but I wonder if i can't ...
6
votes
3
answers
6k
views
Best way to retrieve music metadata from audio files?
I am using the music metadata-browser npm package to retrieve audio metadata from files. This library is being used in an Electron and React desktop app.
To get the metadata of audio files, (and add ...
2
votes
1
answer
500
views
OOP implementation of in-memory file system
I was working on this problem, where I am constructing a Object Oriented structure of file system where you can have Directories and Files. The Directories could have sub Directories and files.
I ...
0
votes
1
answer
373
views
Git hook written on JavaScript
As in many teams, me and my coworkers are putting ticket number into beginning of each commit message. If your branches are starting with ticket number it is easy to create ...
2
votes
1
answer
255
views
Scanning directories and caching paths to an array
What am I trying to do
I'm trying to scan a disk and save (cache) all the paths of files and directories into an array so that I could perform a quick file/directory search later on.
Implementation
...
0
votes
1
answer
594
views
"Quick" save in electron with a conformation dialog
I have implemented a "quick" save for my electron app. There has to be a better way to achieve what I am doing.
The MessageBox will always be triggered on a save ...
3
votes
1
answer
1k
views
Recursively find TypeScript files imported/exported from an entry point
I'd like to know what's the best practice as functional programming in JavaScript to work with arrays and passing them as an argument to a recursive function that may run itself within its branch.
In ...
3
votes
1
answer
2k
views
Generate next available filename based on current date
I have a bit of code that I would like your collective opinions on. Currently, my working code has two return statements. I'm not sure how I feel about having multiple points of exit, however, the ...
12
votes
2
answers
4k
views
Generate a nested structure based on a list of file paths
I'm currently working on a small application, as a learning exercise for a Javascript novice. I need to generate an object based on a folder structure. Here is an example of the folder structure:
...
1
vote
1
answer
74
views
nodeJS, fs, path - creating new directorties
I wrote this function that takes 2 arguments - the path to an existing file - file, and the newRoot name. The function splits ...
3
votes
0
answers
573
views
Recursively list files in provided directory in the style of `npm ls`
I've written a small CLI node program to list the contents of a directory with an output similar to that provided by npm ls but listing both files and directories, ...
1
vote
1
answer
813
views
Optionally creating a directory path based based on existence in NodeJS
I've been doing some reading and tutorials. As such I've contrived a node based project to apply what I've learned. I thought this was a good example as it had some conditional async calls and error ...