Libreria de procesamiento de archivos
- Source:
Methods
(inner) appendFile(path, data, callback)
- Source:
Permite modificar un archivo existente a un desitino especificado si existe modifica el contenido
Example
appendFile('./path.txt', 'text', ( error ) => {
if ( error ) {
throw error
};
// rest of code ...
});
Parameters:
Name | Type | Description |
---|---|---|
path |
string | la ruta donde se almacena el archivo |
data |
string | Uint8Array | ruta donde se va almacenar el archivo |
callback |
callbackCreate | devolucion de llamada cuando crea el archivo |
(inner) checkAsset(url, concat) → {boolean}
- Source:
Permite verificar si el archivo existe
Example
let fileExists = checkAsset( './test.txt', false ) // path relativo
let fileExists = checkAsset( 'test.txt' ) // path global
Parameters:
Name | Type | Default | Description |
---|---|---|---|
url |
string | path del archivo | |
concat |
boolean |
true
|
flag si debe concatenar el path al directorio global |
Returns:
devuelve un flag con el valor encontrado
- Type
- boolean
(inner) copyFile(url, dest) → {string}
- Source:
Permite copiar un archivo a un desitino especificado
Parameters:
Name | Type | Description |
---|---|---|
url |
string | ruta del archivo a copiar |
dest |
string | ruta donde se va almacenar el nuevo archivo |
Returns:
retorna la url del archivo copiado
- Type
- string
(inner) deleteFileSync(url)
- Source:
permite borrar un archivo
Parameters:
Name | Type | Description |
---|---|---|
url |
string | path al archivo a eliminar |
(inner) formatUrl(root, url) → {string}
- Source:
Parameters:
Name | Type | Description |
---|---|---|
root |
string | path relativa del proyecto |
url |
string | path del archivo |
Returns:
retorna el url concatenado
- Type
- string
(inner) getHomePath(fileNameopt) → {string}
- Source:
Example
// se ubica en el directorio home del S.O
let homeDirectory = getHomePath();
// su ubica en el directorio home y adicionalmente le agrega nombre al archivo
let homeDirectory = getHomePath('test.pdf');
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
fileName |
string |
<optional> |
nombre del directorio donde el open winodw inicia la busqueda |
Returns:
retorna el path del home dependiendo del Sistema operativo
- Type
- string
(inner) readFile(url, isPathComplete, isBuffer) → {string|Buffer}
- Source:
Permite leer un archivo
Parameters:
Name | Type | Default | Description |
---|---|---|---|
url |
string | ruta para leer el archivo | |
isPathComplete |
boolean |
false
|
flag que indica que la ruta es completa |
isBuffer |
boolean |
false
|
flag que indica si la respuesta viene en datos buffer |
Returns:
retorna el contenido del archivo
- Type
- string | Buffer
(inner) readFileAssets(url) → {string}
- Source:
Permite leer un archivo dentro de las vistas del renderizado
Parameters:
Name | Type | Description |
---|---|---|
url |
string | ruta para leer el archivo |
Returns:
retorna el contenido de los archivos del direcotrio view
- Type
- string
(inner) readFileImageAsync(path, callback)
- Source:
Funcion que permite leer imagenes de forma asincrona
Parameters:
Name | Type | Description |
---|---|---|
path |
string | ruta para leer el archivo |
callback |
callbackReadImage | respuesta del procesamiento del archivo en base64 |
(inner) readFilePromiseJSON(url, isPathComplete, isBuffer) → {Promise.<Array.<any>>}
- Source:
Lee los archivos en forma de promesa
Parameters:
Name | Type | Default | Description |
---|---|---|---|
url |
string | path del archivo | |
isPathComplete |
boolean |
false
|
flag que indica que la ruta es completa |
isBuffer |
boolean |
false
|
flag que indica si la respuesta viene en datos buffer |
Returns:
- Type
- Promise.<Array.<any>>
(inner) writeFile(path, data, callback)
- Source:
Permite crear un archivo nuevo a un desitino especificado
Example
writeFile('./path.txt', 'text', ( error ) => {
if ( error ) {
throw error
};
// rest of code ...
});
Parameters:
Name | Type | Description |
---|---|---|
path |
string | la ruta donde se almacena el archivo |
data |
string | Uint8Array | ruta donde se va almacenar el archivo |
callback |
callbackCreate | devolucion de llamada cuando crea el archivo |
Type Definitions
callbackCreate(erroropt)
- Source:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
error |
string | Error |
<optional> |
error durante la copia del archivo |
callbackReadImage(data)
- Source:
Parameters:
Name | Type | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
data |
Object | datos de respuesta de la lectura del archivo
Properties
|