hachiware_fs v1.0.3
Hachiware_fs
An extended wrapper package for the file operation package "fs".
A package for getting file / directory information and copying / deleting in a deep hierarchy.
# Sample Source
Place the sample source in the test directory in the package.
L sample1.js
L sample2.js
L sample3.js
- sample1.js .... Get file / directory information list
- sample2.js .... Bulk copy of files / directories.
- sample3.js .... Bulk delete files / directories
# How do you use this?
First, install the npm package with the following command.
npm i hachiware_fs
All you have to do is add the package require code to index.js etc. and you're ready to go.
const fs = require("hachiware_fs");
# Get a list of files/directories up to the deep hierarchy
You can get a list of files / directories up to a deep hierarchy by using the deepReadDir
method.
const fs = require("hachiware_fs");
console.log(fs.ddepReadDir("sample_directory"));
Specify the directory path (relative is also possible) in the argument.
It is assumed that the specified directory path exists.
The return value will be the following object.
{
file:
[ 'testdirectory/dir_1/dir_1a/test.txt',
'testdirectory/dir_1/dir_1b/test.txt',
'testdirectory/dir_1/test.txt',
'testdirectory/test.txt' ],
dir:
[ 'testdirectory/dir_1',
'testdirectory/dir_1/dir_1a',
'testdirectory/dir_1/dir_1b',
'testdirectory/dir_2',
'testdirectory/dir_2/dir_2a',
'testdirectory/dir_2/dir_2b' ]
}
# Bulk copy of files/directories
By using the deepCopy
method, you can easily make a batch copy for each directory.
const fs = require("hachiware_fs");
fs.ddepReadDir("sample_directory","__copy_sample_directory");
Specify the copy source path and copy destination path as arguments, respectively.
This alone copies the files and directories in the source path to the destination path all at once.
# Bulk delete files/directories
By using the deepDelete
method, you can easily delete all directories at once.
const fs = require("hachiware_fs");
fs.deepDelete("sample_directory");
Specify the path to be deleted in the argument.
You can delete the specified path with just this.
Hachiware_fs
An extended wrapper package for the file operation package "fs".
License : MIT License.
Author : Nakatsuji Masato
HP URL : https://hachiware-js.com/
GitHub : https://github.com/masatonakatsuji2021/Hachiware_fs
npm : https://www.npmjs.com/package/Hachiware_fs