
Product
Introducing Socket Firewall Enterprise: Flexible, Configurable Protection for Modern Package Ecosystems
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.
node-bwf-wav-file-reader
Advanced tools
A lightweight module that parses WAV or BWF information data from a wav file into a Javascript Object. Basically retrieves file and header meta data information from a WAV or BWF file.
npm install node-bwf-wav-file-reader --save
# or
yarn install node-bwf-wav-file-reader
const { read: readBwf } = require('node-bwf-wav-file-reader');
readBwf('./__tests__/audio.bwf', function (err, info) {
if (err) console.error(err, info);
else console.log(info);
});
const { readSync: readSyncBwf } = require('node-bwf-wav-file-reader');
(async () => {
const info = await readSyncBwf('./__tests__/audio.bwf');
console.log(info);
})();
import * as bwfWavFileReader from 'node-bwf-wav-file-reader';
bwfWavFileReader.read('./__tests__/audio.bwf', function (err, info) {
if (err) console.error(err, info);
else console.log(info);
});
import * as bwfWavFileReader from 'node-bwf-wav-file-reader';
(async () => {
const info = await bwfWavFileReader.readSync('./__tests__/audio.bwf');
console.log(info);
})();
{ duration: 27.391986111111112,
result:
{ chunkId: 'RIFF',
chunkSize: 15777784,
format: 'WAVE',
subChunkFormatId: 'fmt ',
subChunkFormatSize: 16,
audioFormat: 1,
numChannels: 2,
sampleRate: 96000,
byteRate: 576000,
blockAlign: 6,
bitsPerSample: 24,
subChunkListId: 'LIST',
subChunkListSize: 148,
subChunkInfoId: 'INFO',
subChunkInamId: 'INAM',
subChunkInamSize: 64,
subChunkInamData: 'mySession',
subChunkIsftId: 'ISFT',
subChunkIsftSize: 32,
subChunkIsftData: 'myDevice',
subChunkIartId: 'IART',
subChunkIartSize: 24,
subChunkIartData: '0000CC089DC40A2',
subChunkBextId: 'bext',
subChunkBextSize: 668,
Description: 'mySession|0000CC089DC40A24|400',
Originator: 'myDevice',
OriginatorReference: 'CNCMECC089DC40A24155730911358306',
OriginationDate: '2019-03-22',
OriginationTime: '15:57:30',
TimeReferenceLow: 3281795072,
TimeReferenceHigh: 0,
Version: 2,
UMID: '',
LoudnessValue: 0,
LoudnessRange: 0,
MaxTruePeakLevel: 0,
MaxMomentaryLoudness: 0,
MaxShortTermLoudness: 0 },
stats:
Stats {
dev: 16777220,
mode: 33188,
nlink: 1,
uid: 501,
gid: 20,
rdev: 0,
blksize: 4096,
ino: 8644128473,
size: 15777792,
blocks: 30816,
atimeMs: 1554189495295.2056,
mtimeMs: 1553863606437.2336,
ctimeMs: 1554189504022.6528,
birthtimeMs: 1553863606313.1821,
atime: 2019-04-02T07:18:15.295Z,
mtime: 2019-03-29T12:46:46.437Z,
ctime: 2019-04-02T07:18:24.023Z,
birthtime: 2019-03-29T12:46:46.313Z } }
Duration is in seconds. Stats comes from Node raw fs.statSync() result.
if err is not null, the WAV file is valid.
{ error: true,
invalid_reasons:
[ 'Expected "RIFF" string at 0',
'Expected "WAVE" string at 4',
'Expected "fmt " string at 8',
'Unknwon format: 25711',
'chunk_size does not match file size' ] }
From the command line you can run:
node bwfr.js ./__tests__/audio.bwf
npm test
npm version patch
npm publish
Martin RATINAUD FullStack Developer, creator of
Find me on LinkedIn
FAQs
Lightweight Node.js BWF and WAV file reader
We found that node-bwf-wav-file-reader 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.

Product
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.

Security News
Open source dashboard CNAPulse tracks CVE Numbering Authorities’ publishing activity, highlighting trends and transparency across the CVE ecosystem.

Product
Detect malware, unsafe data flows, and license issues in GitHub Actions with Socket’s new workflow scanning support.