- basd/lib/basd-node
This file contains extensions to lodash that require the Node.js environment. This includes functions for managing directories, retrieving files from URLs, writing data to files, and more.
- basd/lib/basd
This file contains extensions to lodash for a more enhanced usage. This includes functions for data hashing, generating UUIDs, and more. It should be used in browser environments.
This file contains extensions to lodash that require the Node.js environment. This includes functions for managing directories, retrieving files from URLs, writing data to files, and more.
Makes a directory at the given path.
Kind: inner constant of basd/lib/basd-node
Returns: string
- The path of the created directory.
Throws:
Error
If an error other than "EEXIST" occurs.
Param | Type | Description |
---|---|---|
dirpath | string |
The path where to create the directory. |
Recursively removes a directory at the given path.
Kind: inner constant of basd/lib/basd-node
Returns: string
- The path of the removed directory.
Param | Type | Description |
---|---|---|
dirpath | string |
The path of the directory to remove. |
Retrieves a file from a URL.
Kind: inner constant of basd/lib/basd-node
Returns: Promise.<Buffer>
- A promise that resolves with the file data.
Param | Type | Default | Description |
---|---|---|---|
[url] | string |
"'https://i.imgur.com/SHo6Fub.jpeg'" |
The URL of the file to retrieve. |
axios | Axios |
The Axios instance to use for the HTTP request. |
Writes data to a file.
Kind: inner constant of basd/lib/basd-node
Throws:
Error
If an error occurs during writing.
Param | Type | Description |
---|---|---|
buff | Buffer |
The data to write to the file. |
[path] | string |
The path of the file. If not specified, it defaults to 'based-1.png' in the current directory. |
This file contains extensions to lodash for a more enhanced usage. This includes functions for data hashing, generating UUIDs, and more. It should be used in browser environments.
Hashes the given data.
Kind: inner constant of basd/lib/basd
Returns: Buffer
| string
- The hashed output.
Throws:
Error
If data is nil.
Param | Type | Default | Description |
---|---|---|---|
data | any |
The data to hash. | |
[length] | number |
BYTE_LENGTH |
The length of the hashed output. |
[encode] | boolean | string |
true |
Whether to encode the output. If a string is passed, it specifies the type of encoding ('hex' is currently supported). |
Generates a universally unique identifier.
Kind: inner constant of basd/lib/basd
Returns: string
- The generated UUID.
Param | Type | Default | Description |
---|---|---|---|
[bytes] | number |
12 |
The number of random bytes to generate. |
[prefix] | string |
"''" |
The prefix to prepend to the UUID. |