Gathering detailed insights and metrics for file-assistant
Gathering detailed insights and metrics for file-assistant
Gathering detailed insights and metrics for file-assistant
Gathering detailed insights and metrics for file-assistant
@typed-assistant/logger
A wrapper around [Pino](https://github.com/pinojs/pino). Used to log to the console, and to a log file.
repomix
A tool to pack repository contents to single file for AI consumption
fs-assistant
Making annoying fs operations easier
image-size-assistant
This Sketch Assistant checks the dimensions of the images in your document, to find opportunities to reduce the file size.
npm install file-assistant
Typescript
Module System
Node Version
NPM Version
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
3
file-assistant
is a module that creates, copies or moves the folders and files into the specified path or modifies the files' content according to the given [Array] structure object
(or .json
file path) instructions.
structure object
of the folders and files, that you want to create or use to modify the existing folders and files structure.structure object
as the argument through file-assistant
function1const fileAssistant = require('file-assistant');
The fileAssistant
contains 4 methods:
fileAssistant
to handle the folders and files due to the structure object
[see below]fileAssistant.structurize
to automatically generate the structure object
for the elements of the given folder path [see below]fileAssistant.compare
to compare the differences between two folders (which elements are extraneous, missing and already existing) [see below]fileAssistant.ensureDir
to create the folders chain recursively [see below]Structure object
fileAssistant.structurize
methodfileAssistant.compare
methodfileAssistant.ensureDir
methodIf you are confused by the excess of the description, there is a list of common tips:
npm install file-assistant
> git clone https://github.com/devrafalko/file-assistant
> cd file-assistant
> npm install
> npm test
# or
> npm test deep
fileAssistant(root,structure,done[,each])
1const fileAssistant = require('file-assistant'); 2 3const root = './dist', 4const structure = [ 5 {file:'index.html'}, 6 {file:'styles.css', copy:'./styles/main.css'} 7]; 8 9fileAssistant(root, structure, done, each); 10 11function done(o){ 12 console.log(o.error); 13 console.log(o.files); 14 console.log(o.dirs); 15} 16function each(o){ 17 console.log(o.success); 18 console.log(o.item); 19 console.log(o.relative); 20 console.log(o.from); 21} 22
root
[String]structure
object should be handled.root
directory does not exist, it is created.root
, the Error is passed through done
callback.structure
[Array|String]structure
argument should contain the list of files and folders and specify the actions that should be undertaken for them in the root
folder. [See below]structure
argument should indicate the path to the .json
file that contain the list of files and folders and specify the actions that should be undertaken for them in the root
folder. [See below]structure object
or just follow the instructions passed through done
callback error
property.You can also generate the
structure object
(and.json
file containing that structure) for the chosen folder withfileAssistant.structurize
method.
done
[Function]done
callback function with the following properties:
root
Returns the [String] root
path argument passed through the module functionerror
Returns [Error] if something went wrong and the continuation of creating folders and files was aborted, eg. if the structure
argument is invalid. Otherwise returns null
. See also how the errors are handled.dirs
Returns the [Object] object of the following properties:
success
[Array] list of the absolute paths of all created/copied/moved/merged/overwritten folders.warning
[Array] list of the absolute paths of all intentionally aborted actions on folders (eg. if the folder was not overwritten, as intended)failure
[Array] list of the absolute paths of all unsuccessful actions on folders (eg. if the folder was inaccessible)files
Returns the [Object] object of the following properties:
success
[Array] list of the absolute paths of all created/copied/moved/overwritten/modified files.warning
[Array] list of the absolute paths of all intentionally aborted actions on files (eg. if the file was not overwritten, as intended)failure
[Array] list of the absolute paths of all unsuccessful actions on files (eg. if the file was inaccessible)unrecognized
Returns the [Object] object of the following properties:
failure
[Array] list of the absolute paths of all elements that the access was denied foreach
[Function] (optional)each
callback function with the following properties:
success
null
.'The given content was successfully appended to the "script.js" file.'
.warning
null
.'The already existing folder "components/footer" could not be overwritten by the newly created folder, due to the "overwrite" property settings.'
.failure
null
.'The item of the path "modules/locked.js" is inaccessible and could not be moved into the "dist/script.js" path.'
.item
'file'
for file element, 'dir'
for folder element or 'unrecognized'
when the access to the element was denied.action
overwritten
true
if the file or folder has been overwritten. Otherwise returns false
.modified
true
if the beforeWrite
property was used and the file
was created/overwritten with the modified content. Otherwise returns false.
from
copy
, move
, merge
or writeFrom
was defined in the structure object
).
Returns null
if the file or folder was created or modified (when the property contents
, write
or none property was defined in the structure object
).absolute
relative
root
root
path argument passed through the module function.done
callback function as a third parameter in the fileAssistant
module function execution, otherwise the TypeError
will be thrown.done
callback function, so your app would not collapse.fileAssistant
module function with an incorrect root
or structure
arguments, you are informed in the done
callback function about that, so you can follow these instructions to create a valid structure object
.done
and each
callback functions as warning
and failure
properties.fileAssistant
module tries to execute as many actions as possible, then returns results in done
callback function (and each single time in each
callback function as well).structure object
and the final folders and files structureAssuming that you want to generate the following folders and files structure in the ./dist
path:
dist
├ scripts
│ ├ index.js
│ └ ajax.js
├ styles
│ ├ css
│ │ ├ layout.css
│ │ └ media.css
│ └ scss
│ └ mixins.scss
└ templates
├ main.html
├ menubar.html
├ login.html
└ contact.html
use this javascript syntax:
1const fileAssistant = require('file-assistant'); 2const destination = './dist'; 3const structure = [ 4 {dir:'scripts', contents:[ 5 {file:'index.js'}, 6 {file:'ajax.js'} 7 ]}, 8 {dir:'styles', contents:[ 9 {dir:'css', contents:[ 10 {file:'layout.css'}, 11 {file:'media.css'} 12 ]}, 13 {dir:'scss', contents:[ 14 {file:'mixins.scss'} 15 ]} 16 ]}, 17 {dir:'templates', contents:[ 18 {file:'header.html'}, 19 {file:'navbar.html'} 20 ]} 21]; 22 23fileAssistant(destination, structure, (done)=>{/*...*/}, (each)=>{/*...*/});
structure object
The structure object
can be stored in the JSON file.
1[ 2 {"dir":"scripts", "contents":[ 3 {"file":"index.js"}, 4 {"file":"ajax.js"} 5 ]} 6]
and then loaded in the structure
parameter:
1const fileAssistant = require('file-assistant'); 2const destination = './dist'; 3const structure = './templates/structure.json'; 4 5fileAssistant(destination, structure, (done)=>{/*...*/}, (each)=>{/*...*/});
or in the contents
property inside of the structure
object:
1const fileAssistant = require('file-assistant'); 2const destination = './dist'; 3const structure = [ 4 {dir:'styles'}, 5 {dir:'scripts', contents:'./templates/structure.json'} 6]; 7 8fileAssistant(destination, structure, (done)=>{/*...*/}, (each)=>{/*...*/});
or even loaded in another .json
file:
1[ 2 {"dir":"scripts", "contents":[ 3 {"file":"index.js"}, 4 {"file":"ajax.js"} 5 ]}, 6 {"dir":"scripts", "contents":"./templates/scripts.json"} 7]
You can also generate the
structure object
(and.json
file containing that structure) for the chosen folder withfileAssistant.structurize
method.
structure object
Properties:Each [Object] Item of [Array] scope can contain the following properties:
file
Type: [String]
Default: undefined
Description:
'index.html'
, 'ajax.js'
.overwrite
property.file
or dir
property. Item cannot contain both dir
and file
property. They exclude each other. Use dir
to create folder or file
to create a file.dir
and file
properties. In order to create subfolders, use contents
property. (See how the structure object
tree should be built)Sample:
{file:'style.css'}
It creates a new style.css
file with empty content in the specified root
path.dir
Type: [String]
Default: undefined
Description:
'styles'
, 'modules'
overwrite
property.file
or dir
property. Item cannot contain both dir
and file
property. They exclude each other. Use dir
to create folder or file
to create a file.dir
and file
properties. In order to create subfolders, use contents
property. (See how the structure object
tree should be built)Sample:
{dir:'prod'}
prod
folder in the specified root
path.contents
content
is also validType: [Array|String]
Default: undefined
Target: dir
Description:
contents
property defines the dir
(local) structure object
, that should be created in the dir
folder.contents
property can indicate the [Array] object that contains the structure object
that should be created in the defined dir
folder.contents
property can also indicate the [String] path to the .json
file that contains the structure object
that should be created in the defined dir
folder.contents
elements), use overwrite
property.move
, copy
, merge
, contents
, write
and writeFrom
properties at the same time. They exclude each other.You can also generate the
structure object
(and.json
file containing that structure) for the chosen folder withfileAssistant.structurize
method.
move
Type: [String]
Default: undefined
Target: file
|dir
Description:
file
property is specified in the Item, the move
property indicates the path to the file that should be moved to the path of the defined file
property.dir
property is specified in the Item, the move
property indicates the path to the folder that should be moved (with its all contents) to the path of the defined dir
property.move
one, use overwrite
property.move
property is not relative to the root
. It is recommended to use the paths related to the __dirname
or the absolute paths.move
, copy
, merge
, contents
, write
and writeFrom
properties at the same time. They exclude each other.Sample
{file:'style.css', move:'./dist/main.css'}
./dist/main.css
file and pastes it into the specified root
path as style.css
file.{dir:'prod', move:'./dist'}
It cuts the dist
folder with its all contents and pastes it into the specified root
path as prod
folder.copy
Type: [String]
Default: undefined
Target: file
|dir
Description:
file
property is specified in the Item, the copy
property indicates the path to the file that should be copied to the path of the defined file
property.dir
property is specified in the Item, the copy
property indicates the path to the folder that should be copied (with its all contents) to the path of the defined dir
property.copy
one, use overwrite
property.copy
property is not relative to the root
path. It is recommended to use the paths related to the __dirname
or the absolute paths.move
, copy
, merge
, contents
, write
and writeFrom
properties at the same time. They exclude each other.Sample:
{file:'style.css', copy:'./dist/main.css'}
./dist/main.css
file and pastes it into the specified root
path as style.css
file.{dir:'prod', copy:'./dist'}
dist
folder with its all contents and pastes it into the specified root
path as prod
folder.merge
Type: [String]
Default: undefined
Target: dir
Description:
dir
folder.dir
folder does not exist, the contents are just copied to the path of the defined dir
property.merge
ones, use overwrite
property.move
, copy
, merge
, contents
, write
and writeFrom
properties at the same time. They exclude each other.Sample:
{dir:'prod', merge:'./dist'}
dist
folder with its all contents and pastes it into the specified root
path as prod
folder. If prod
folder already exists, its contents are merged with the contents of ./dist
folder.write
Type: [String]
Default: undefined
Target: file
Description:
write
property indicates the [String] content that should be used as the content of the new file
.overwrite
property.move
, copy
, merge
, contents
, write
and writeFrom
properties at the same time. They exclude each other.Sample:
{file:'style.css', write:'body{margin:0px}'}
style.css
file in the specified root
path with the body{margin:0px}
content.writeFrom
writefrom
is also validType: [String]
Default: undefined
Target: file
Description:
data
property indicates the [String] path to the file, which content should be used as the content of the new file
.overwrite
property.move
, copy
, merge
, contents
, write
and writeFrom
properties at the same time. They exclude each other.Sample:
{file:'style.css', writeFrom:'./dist/main.css'}
style.css
file in the specified root
path with the content read from the ./dist/main.css
file.beforeWrite
beforewrite
is also validType: [Function]
Default: undefined
Target: file
Description:
file
before this file is created/overwritten.write
: the value content is taken and passed through the beforeWrite
functionwriteFrom
, copy
, move
: the content is read from the file and passed through the beforeWrite
functionbeforeWrite
property is used in combination with write
or writeFrom
and overwrite
:true
properties, the new modified content is appended to the file
rather than overwrite the current content.beforeWrite
is defined, this function is executed with the following arguments:
content
: It gives the access to the (utf8) content taken from write
, writeFrom
, move
or copy
resolve
This is callback function. When the new content is already modified, call resolve
to continue the process of handling files and folder by the file-assistant
package. Remember to pass [String|Buffer] modified
data through resolve
callback function: resolve(modified)
, othwerwise the action will be failed for this file.reject
This is callback function. If something went wrong with modifying the content and you want to abort the action of creating the file with the new modified content, call reject
callback function. Then the each
callback will be called with failure
message. The additional [String] message
can be passed through reject
callback function. It will be appended to the each
callback failure
message: reject(message)
write
, writeFrom
, move
or copy
file's content is not affected by this function. The modified content is used only to modify the file
content.1const fileAssistant = require('file-assistant'); 2const destination = './prod'; 3const structure = [ 4 {file:'data.txt', writeFrom:'./dist/data.txt', beforeWrite:parseData} 5]; 6 7fileAssistant(destination, structure, (done)=>{/*...*/}, (each)=>{/*...*/}); 8 9function parseData(getData, resolve, reject){ 10 //getData is the utf-8 content taken from './dist/data.txt' file 11 if(getData.length>100) { 12 reject('The text is too long!'); 13 } else { 14 const modifiedData = getData.toUpperCase(); 15 resolve(modifiedData); 16 } 17}
overwrite
Type: [Boolean]
Default: false
Target: file
|dir
Description: It is useful, if the file or folder that you are about to create, move, copy, merge or modify already exists in the specified path. If the file or folder does not exist, the effect will be the same regardless the overwrite
property is used with true
or false
value (or undefined).
overwrite
is true
, it removes the existing file or folder and creates the new one, according to the structure
optionsoverwrite
is false
(default), it does not remove the existing file or folder, instead of that:
style.css
file already exists in the destination root
path:{file:'style.css', overwrite:true}
style.css
file and replaces it with the new empty style.css
file.{file:'style.css', overwrite:false}
style.css
file is not removed and the new style.css
is not created.each
warning
property will warn you about aborted action and the success
property will be null
.{file:'style.css', copy:'./dist/main.css', overwrite:true}
style.css
file and replaces it with the copied ./dist/main.css
file.{file:'style.css', copy:'./dist/main.css', overwrite:false}
style.css
file is not removed and the ./dist/main.css
file is not copied/pasted.each
warning
property will warn you about aborted action and the success
property will be null
.{file:'style.css', move:'./dist/main.css', overwrite:true}
style.css
file and replaces it with the cut ./dist/main.css
file.{file:'style.css', move:'./dist/main.css', overwrite:false}
style.css
file is not removed and the ./dist/main.css
file is not cut/pasted.each
warning
property will warn you about aborted action and the success
property will be null
.{file:'style.css', write:'body{margin:0px}', overwrite:true}
style.css
file with the new body{margin:0px}
content.{file:'style.css', write:'body{margin:0px}', overwrite:false}
body{margin:0px}
content at the end of the content of the existing style.css
file.{file:'style.css', writeFrom:'./dist/main.css', overwrite:true}
style.css
file with the content read from the ./dist/main.css
file.{file:'style.css', writeFrom:'./dist/main.css', overwrite:false}
./dist/main.css
file at the end of the content of the existing style.css
file.prod
folder already exists in the destination root
path:{dir:'prod', overwrite:true}
prod
folder and replaces it with the new empty prod
folder.contents
property is defined in the Item with subfolders and subfiles specified, it also creates all of them inside of the new prod
folder.{dir:'prod', overwrite:false}
prod
folder is not removed and the new prod
folder is not created.each
warning
property will warn you about aborted action and the success
property will be null
.contents
property is defined in the Item with subfolders and subfiles specified, the action for them is undertaken according to their own overwrite
setting.In the following sample, if the prod
folder already exists, it is not removed and replaced by the new prod
folder with all its contents (it keeps its all current contents). The styles.css
and index.html
have their own overwrite
property. If the styles.css
file already exists, it is replaced by the new styles.css
file. If the index.html
file already exists, it is not replaced by the new index.html
file.
1const structure = [ 2 {dir:'prod', overwrite:false, contents:[ 3 {file:'styles.css', overwrite:true}, 4 {file:'index.html', overwrite:false} 5 ]} 6];
{dir:'prod', copy:'./dist', overwrite:true}
prod
folder and replaces it with the copied dist
folder with all its contents.{dir:'prod', copy:'./dist', overwrite:false}
prod
folder is not removed and the dist
folder is not copied/pasted.each
warning
property will warn you about aborted action and the success
property will be null
.{dir:'prod', move:'./dist', overwrite:true}
prod
folder, and replaces it by the cut dist
folder with all its contents.{dir:'prod', move:'./dist', overwrite:false}
prod
folder is not removed and the dist
folder is not cut/pasted.each
warning
property will warn you about aborted action and the success
property will be null
.{dir:'prod', merge:'./dist', overwrite:true}
dist
folder and the structure of prod
folderprod
folder are copied from dist
folder into itprod
folder are not removed and are not replaced by their dist
equivalentsprod
folder (and all its subfolders) are removed and are replaced by their dist
equivalents (of the same relative path).#The './dist' folder to be merged:
dist
├ scripts
│ ├ index.js
│ └ ajax.js
└ styles
└ sayout.css
#Already existed 'prod' folder:
prod
├ scripts
│ ├ index.js
│ └ utils.js
└ templates
└ login.html
#After merge process:
prod
├ scripts
│ ├ index.js //this file had already existed and was replaced by './dist/scripts/index.js'
│ ├ ajax.js
│ └ utils.js
├ templates
│ └ login.html
└ styles
└ sayout.css
{dir:'prod', merge:'./dist', overwrite:false}
dist
folder and the structure of prod
folderprod
folder are copied from dist
folder into itprod
folder are not removed and are not replaced by their dist
equivalentsprod
folder (and all its subfolders) are not removed and are not replaced by their dist
equivalents (of the same relative path). Instead of that:
#The './dist' folder to be merged:
dist
├ scripts
│ ├ index.js
│ └ ajax.js
└ styles
└ sayout.css
#Already existed 'prod' folder:
prod
├ scripts
│ ├ index.js
│ └ utils.js
└ templates
└ login.html
#After merge process:
prod
├ scripts
│ ├ index.js //this file had already existed and the action was aborted
│ ├ ajax.js
│ └ utils.js
├ templates
│ └ login.html
└ styles
└ sayout.css
fileAssistant.structurize(path[,json],callback)
It converts the given path
folder's contents into the abstract [Array] structure object
representation of it. You can for example modify the returned object and/or use it as the structure
parameter, to create the files and folders due to this returned structure object
.
path
[String]structure object
representation.json
[String] (optional).json
file with the returned [Array] structure object
should be created..json
, the correct extension is automatically appended.callback
[Function]callback
function is executed after the operation is done.callback
function:
[0]
[Error] object, if the path
or json
paths are invalid, inaccessible, etc. Otherwise it returns null
.[1]
[Array] structure object
representing the structure of the given path
folder.The ./dist folder to be structurized:
dist
├ scripts
│ ├ index.js
│ └ ajax.js
└ styles
└ layout.css
The returned [Array] object representation of the given ./dist
folder's contents:
1const folder = './dist'; 2const json = './dist/structure.json'; 3fileAssistant.structurize(folder,json,(err,data)=>{ 4 console.log(data); 5/* 6[ 7 {dir:'scripts', contents:[ 8 {file:'index.js'}, 9 {file:'ajax.js'} 10 ]}, 11 {dir:'styles', contents:[ 12 {file:'layout.css'} 13 ]} 14] 15*/ 16});
fileAssistant.compare(model,compared,[config,]callback)
It compares the paths of model
and compared
folders contents and returns the information about the differences.
According to the given information, you can generate the
structure object
and use it to create, copy, move or modify files or folders.
model
[String]compared
folder should match.compared
[String]model
folder.config
[Object]compare
method with the following [Object] config
's properties:
depth
[Number|null] (default:null)compare
function should explore the folders in the given model
and compared
directories.null
(default) - it compares all subfiles and subfolders of all levels of the model
and compared
directories.model
and compared
elements; eg. ./styles
, ./index.html
.model
and compared
elements; eg. ./styles/css
, ./scripts/ajax.js
.exclude
[Array|String] (default:[])"./bin"
.["./node_modules", "./bin"]
.model
and compared
paths, otherwise they will be not recognized.'./node_modules'
or './.git'
to make the compare
module faster.callback
[Function]callback
function is executed after the operation is done.callback
function:[0]
[Error] object, if the model
or compared
paths are invalid, inaccessible, etc. Otherwise it returns null
.[1]
[Object] object with the following properties:
model
Returns the [String] absolute path to the model
foldercompared
Returns the [String] absolute path to the compared
folderdirs
missing
Returns the [Array] list of the relative paths to the folders that exist in the model
folder, but do not exist in the compared
folderexisting
Returns the [Array] list of the relative paths to the folders that exist both in the model
folder and compared
folderextraneous
Returns the [Array] list of the relative paths to the folders that exist in the compared
folder, but do not exist in the model
folderfiles
missing
Returns the [Array] list of the relative paths to the files that exist in the model
folder, but do not exist in the compared
folderexisting
Returns the [Array] list of the relative paths to the files that exist both in the model
folder and compared
folderextraneous
Returns the [Array] list of the relative paths to the files that exist in the compared
folder, but do not exist in the model
folderinaccessible
Returns the [Array] list of all elements that the access was denied for.1const model = './dist'; 2const compared = './prod'; 3fileAssistant.compare(model,compared,(err,data)=>{ 4 console.log(err); 5 console.log(data.dirs.missing); 6 console.log(data.files.extraneous); 7});
fileAssistant.ensureDir(path,callback)
It creates the folders chain recursively.
If the folder (or its subfolder) already exists it is neither removed nor overwritten.
path
[String]'./dist'
'./dist/modules/es6/libs'
callback
[String]null
if the folder(s) have been successfully created, otherwise [Error]1const fileAssistant = require('file-assistant'); 2const destination = './prod'; 3const structure = [ 4 {file:'styles.css', overwrite:false}, 5 {file:'index.html'} //overwrite:false is default, it can be omitted 6]; 7 8fileAssistant(destination, structure, (done)=>{/*...*/}, (each)=>{/*...*/});
1const fileAssistant = require('file-assistant'); 2const destination = './prod'; 3const structure = [ 4 {file:'styles.css', overwrite:true}, 5 {file:'index.html', overwrite:true} 6]; 7 8fileAssistant(destination, structure, (done)=>{/*...*/}, (each)=>{/*...*/});
1const fileAssistant = require('file-assistant'); 2const destination = './prod'; 3const structure = [ 4 {file:'readme.md', copy:'./templates/docs.txt', overwrite:false} 5 {file:'LICENSE', copy:'./templates/mit-license.txt'} //overwrite:false is default, it can be omitted 6]; 7 8fileAssistant(destination, structure, (done)=>{/*...*/}, (each)=>{/*...*/});
1const fileAssistant = require('file-assistant'); 2const destination = './prod'; 3const structure = [ 4 {file:'styles.css', overwrite:true}, 5 {file:'index.html', overwrite:true} 6]; 7 8fileAssistant(destination, structure, (done)=>{/*...*/}, (each)=>{/*...*/});
1const fileAssistant = require('file-assistant'); 2const destination = './prod'; 3const structure = [ 4 {file:'styles.css', move:'./dist/bundled.css', overwrite:false}, 5 {file:'main.js', move:'./dist/bundled.js'} //overwrite:false is default, it can be omitted 6]; 7 8fileAssistant(destination, structure, (done)=>{/*...*/}, (each)=>{/*...*/});
1const fileAssistant = require('file-assistant'); 2const destination = './prod'; 3const structure = [ 4 {file:'styles.css', move:'./dist/bundled.css', overwrite:true}, 5 {file:'main.js', move:'./dist/bundled.js', overwrite:true} 6]; 7 8fileAssistant(destination, structure, (done)=>{/*...*/}, (each)=>{/*...*/});
1const fileAssistant = require('file-assistant'); 2const destination = './prod'; 3const structure = [ 4 {file:'styles.css', write:'body:{box-sizing:border-box}', overwrite:false} 5]; 6 7fileAssistant(destination, structure, (done)=>{/*...*/}, (each)=>{/*...*/});
1const fileAssistant = require('file-assistant'); 2const destination = './prod'; 3const htmlTemplate = 4`<html> 5 <head></head> 6 <body></body> 7</html>`; 8const structure = [ 9 {file:'index.html', write:htmlTemplate, overwrite:true} 10]; 11 12fileAssistant(destination, structure, (done)=>{/*...*/}, (each)=>{/*...*/});
1const fileAssistant = require('file-assistant'); 2const destination = './prod'; 3const structure = [ 4 {file:'styles.css', writeFrom:'./templates/reset.css', overwrite:false} 5]; 6 7fileAssistant(destination, structure, (done)=>{/*...*/}, (each)=>{/*...*/});
1const fileAssistant = require('file-assistant'); 2const destination = './prod'; 3const structure = [ 4 {file:'index.html', writeFrom:'./templates/html-template.html', overwrite:true} 5]; 6 7fileAssistant(destination, structure, (done)=>{/*...*/}, (each)=>{/*...*/});
1const fileAssistant = require('file-assistant'); 2const destination = './prod'; 3const structure = [ 4 {dir:'lib', overwrite:false}, 5 {dir:'src'} //overwrite:false is default, it can be omitted 6]; 7 8fileAssistant(destination, structure, (done)=>{/*...*/}, (each)=>{/*...*/});
1const fileAssistant = require('file-assistant'); 2const destination = './prod'; 3const structure = [ 4 {dir:'lib', overwrite:false}, 5 {dir:'src', contents:[ 6 {dir:'styles'}, 7 {dir:'scripts'}, 8 {dir:'tests'} 9 ]} //overwrite:false is default, it can be omitted 10]; 11 12fileAssistant(destination, structure, (done)=>{/*...*/}, (each)=>{/*...*/});
1const fileAssistant = require('file-assistant'); 2const destination = './prod'; 3const structure = [ 4 {dir:'temp', overwrite:true} 5]; 6 7fileAssistant(destination, structure, (done)=>{/*...*/}, (each)=>{/*...*/});
1const fileAssistant = require('file-assistant'); 2const destination = './prod'; 3const structure = [ 4 {dir:'src', contents:[ 5 {dir:'styles', contents:[ 6 {file:'styles.css'} 7 ]}, 8 {dir:'scripts'}, 9 {dir:'tests'} 10 ], overwrite:true} 11]; 12 13fileAssistant(destination, structure, (done)=>{/*...*/}, (each)=>{/*...*/});
1const fileAssistant = require('file-assistant'); 2const destination = './prod'; 3const structure = [ 4 {dir:'styles', contents:[ 5 {file:'styles.css', overwrite:false}, 6 {file:'reset.css', overwrite:false} 7 ]}, 8 ], overwrite:false} 9]; 10 11fileAssistant(destination, structure, (done)=>{/*...*/}, (each)=>{/*...*/});
1const fileAssistant = require('file-assistant'); 2const destination = './prod'; 3const structure = [ 4 {dir:'styles', contents:[ 5 {file:'styles.css', overwrite:true}, 6 {file:'reset.css', overwrite:true} 7 ]}, 8 ], overwrite:false} 9]; 10 11fileAssistant(destination, structure, (done)=>{/*...*/}, (each)=>{/*...*/});
1const fileAssistant = require('file-assistant'); 2const destination = './prod'; 3const structure = [ 4 {dir:'styles', copy:'./dist/styles', overwrite:false} 5]; 6 7fileAssistant(destination, structure, (done)=>{/*...*/}, (each)=>{/*...*/});
1const fileAssistant = require('file-assistant'); 2const destination = './prod'; 3const structure = [ 4 {dir:'styles', copy:'./dist/styles', overwrite:true} 5]; 6 7fileAssistant(destination, structure, (done)=>{/*...*/}, (each)=>{/*...*/});
1const fileAssistant = require('file-assistant'); 2const destination = './prod'; 3const structure = [ 4 {dir:'styles', move:'./dist/styles', overwrite:false} 5]; 6 7fileAssistant(destination, structure, (done)=>{/*...*/}, (each)=>{/*...*/});
1const fileAssistant = require('file-assistant'); 2const destination = './prod'; 3const structure = [ 4 {dir:'styles', move:'./dist/styles', overwrite:true} 5]; 6 7fileAssistant(destination, structure, (done)=>{/*...*/}, (each)=>{/*...*/});
1const fileAssistant = require('file-assistant'); 2const destination = './dist'; 3const structure = [ 4 {dir:'lib', merge:'./project/modules', overwrite:false} 5]; 6 7fileAssistant(destination, structure, (done)=>{/*...*/}, (each)=>{/*...*/});
1const fileAssistant = require('file-assistant'); 2const destination = './project'; 3const structure = [ 4 {dir:'prod', merge:'./project/dist', overwrite:true} 5]; 6 7fileAssistant(destination, structure, (done)=>{/*...*/}, (each)=>{/*...*/});
No vulnerabilities found.
No security vulnerabilities found.