Security News
PyPI Introduces Digital Attestations to Strengthen Python Package Security
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
audio-type-detect
Advanced tools
Detect an audio file type from remote url or ArrayBuffer.
According to the magic number of a file, we can detect the type of an audio file with or without a file suffix.
npm install audio-type-detect --save
detect from url
import getAudioType from 'audio-type-detect'
// an aac audio file without file suffix
const url = 'https://0345-1400187352-1256635546.cos.ap-shanghai.myqcloud.com/rychou/e3801cfc517873a5a5471241e1da1869'
getAudioType(url).then(type => {
console.log(type)
})
// ouput aac
detect from buffer
import { getAudioTypeFromBuffer } from 'audio-type-detect'
// an aac audio file without file suffix
const url = 'https://0345-1400187352-1256635546.cos.ap-shanghai.myqcloud.com/rychou/e3801cfc517873a5a5471241e1da1869'
const xhr = new XMLHttpRequest();
xhr.open('GET', 'url');
xhr.responseType = 'arraybuffer';
xhr.send();
xhr.onload = () => {
console.log(getAudioTypeFromBuffer(xhr.response));
// output aac
};
getAudioType(url) -> { Promise }
get audio file type from an url.
Parameters:
Name | Type | Description |
---|---|---|
url | String | The audio file url. |
Returns:
return a Promise
object
getAudioType(url).then(type => {})
the type( String
) of file. if detect failure, it return false
getAudioType(url).catch(error => {})
getAudioTypeFromBuffer(buffer) -> { String }
get audio file type from an array buffer.
Parameters:
Name | Type | Description |
---|---|---|
url | String | The audio file url. |
Returns:
return the type( String
) of file. if detect failure, it return false
mp3
, flac
, aac
, oga
, wav
, wma
, amr
FAQs
detect audio file type from url
The npm package audio-type-detect receives a total of 8 weekly downloads. As such, audio-type-detect popularity was classified as not popular.
We found that audio-type-detect demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.