Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

xa-dtx

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

xa-dtx - npm Package Compare versions

Comparing version 0.0.3 to 0.0.4

13

converter/index.js

@@ -8,4 +8,4 @@ 'use strict';

* Converts XA audio file to RIFF WAV
* @param {(string|Buffer|URL|Integer)} srcFilename Path to XA audio file
* @param {(string|Buffer|URL|Integer)=} dstFilename Destination of decoded RIFF
* @param {(string|Buffer)} srcFilename Path to XA audio file
* @param {string=} dstFilename Destination of decoded RIFF
* @returns {Promise} Decoded buffer

@@ -15,3 +15,3 @@ */

let converter = new XAConverter(srcFilename);
return converter.convert()
return converter.convert(srcFilename)
.then(wav => {

@@ -34,8 +34,1 @@ if (!dstFilename) {

};

@@ -8,5 +8,3 @@ 'use strict';

class XAConverter {
constructor(path) {
this._path = path;
constructor() {
this._c1map = [0, 240, 460, 392, 488];

@@ -16,18 +14,24 @@ this._c2map = [0, 0, 208, 220, 240];

convert() {
return new Promise((resolve, reject) => {
fs.readFile(this._path, (error, buffer) => {
if (error) {
reject(error);
return;
}
convert(input) {
if (typeof input === 'string') {
return new Promise((resolve, reject) => {
fs.readFile(input, (error, buffer) => {
if (error) {
return reject(error);
}
return this
.loadXAStream(buffer)
.then(() => this.prepareWavStream())
.then(() => this.decodeXAStream())
.then(resolve);
return resolve(this.convertBuffer(buffer));
});
});
}
else {
return this.convertBuffer(input);
}
}
})
convertBuffer(buffer) {
return this
.loadXAStream(buffer)
.then(() => this.prepareWavStream())
.then(() => this.decodeXAStream())
}

@@ -34,0 +38,0 @@

{
"name": "xa-dtx",
"version": "0.0.3",
"version": "0.0.4",
"description": "DTX XA audio to WAV converter",
"main": "index.js",
"scripts": {
"test": "mocha tests/test.js"
"test": "mocha tests"
},

@@ -9,0 +9,0 @@ "repository": {

@@ -1,8 +0,6 @@

<h1 align="center">DTX XA to WAV conversion library</h1>
<p align="center">
<p align="right">
<a href="https://travis-ci.org/drummaniac/xa-dtx"><img src="https://travis-ci.org/drummaniac/xa-dtx.svg?branch=master" alt="Travis CI"></a>
</p>
---
<h1 align="center">DTX XA to WAV conversion library</h1>

@@ -17,2 +15,12 @@ Usage example:

});
convert('file.xa', 'file.wav').then(() => {
console.log('XA file converted to WAV file');
});
let xaBuffer = fs.readFileSync('file.xa')
convert(xaBuffer).then(wav => {
console.log('XA buffer converted to buffer', wav);
});
```
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc