Methods
# createAudioFormatter(audioInput) → {AudioFormatterNode|AudioFormatterBrowser}
Creates an instance of the appropriate AudioFormatter (Node or Browser) based on the environment and input type.
Parameters:
Name | Type | Description |
---|---|---|
audioInput |
string
|
Blob
|
The path to the audio file or the audio Blob/URL. |
If the environment is unsupported or the input type is invalid.
Error
An instance of the appropriate AudioFormatter.
AudioFormatterNode
|
AudioFormatterBrowser
# isBlob(input) → {boolean}
Checks if the provided input is a Blob.
Parameters:
Name | Type | Description |
---|---|---|
input |
any
|
The input to check. |
- True if the input is a Blob, false otherwise.
boolean
# isBrowser() → {boolean}
Checks if the current runtime environment is a browser.
True if the environment is a browser, false otherwise.
boolean
# isNode() → {boolean}
Checks if the current runtime environment is Node.js.
True if the environment is Node.js, false otherwise.
boolean
# isPath(input) → {boolean}
Checks if the provided input is a valid path.
This is a very basic check and might need to be more robust.
Parameters:
Name | Type | Description |
---|---|---|
input |
any
|
The input to check. |
- True if the input is a string, false otherwise.
boolean
# isURL(input) → {boolean}
Checks if the provided input is a valid URL.
Parameters:
Name | Type | Description |
---|---|---|
input |
any
|
The input to check. |
- True if the input is a valid URL, false otherwise.
boolean
# async thisAudio(audioFilePath) → {Promise.<Object>}
Asynchronously processes an audio file, returning structured data or an error object.
Parameters:
Name | Type | Description |
---|---|---|
audioFilePath |
string
|
The path or URL to the audio file. |
A promise that resolves to an object indicating success or failure, with data or an error message.
Promise.<Object>