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

ableton

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ableton - npm Package Compare versions

Comparing version 0.0.3 to 0.0.5

test/empty.als

81

ableton.js

@@ -1,4 +0,4 @@

// Generated by CoffeeScript 1.8.0
// Generated by CoffeeScript 1.9.1
(function() {
var Ableton, Builder, Parser, cheerio, concat, fs, zlib, _ref;
var Ableton, Builder, Parser, cheerio, concat, fs, fsError, onLoad, ref, unzipError, zlib;

@@ -11,61 +11,62 @@ fs = require('fs');

_ref = require('xml2js'), Parser = _ref.Parser, Builder = _ref.Builder;
ref = require('xml2js'), Parser = ref.Parser, Builder = ref.Builder;
cheerio = require('cheerio');
fsError = function(callback) {
return function(error) {
switch (error.code) {
case 'ENOENT':
return callback(new Error("'" + path + "' does not exist"), null);
case 'EISDIR':
return callback(new Error("'" + path + "' is a directory"), null);
default:
console.log(error);
return callback(new Error('Unknown error'));
}
};
};
unzipError = function(callback) {
return function(error) {
return callback(new Error("'" + path + "' is not a valid Ableton project"), null);
};
};
onLoad = function(callback) {
return function(xml) {
var dom;
dom = cheerio.load(xml);
return callback(null, dom);
};
};
Ableton = (function() {
function Ableton(path) {
this.path = path;
function Ableton(path1) {
this.path = path1;
}
Ableton.prototype.read = function(callback) {
var parser, path;
var parser;
parser = new Parser({
mergeAttrs: true
});
path = this.path;
return fs.createReadStream(path).on('error', function(error) {
switch (error.code) {
case 'ENOENT':
return callback("'" + path + "' does not exist");
case 'EISDIR':
return callback("'" + path + "' is a directory");
default:
console.log(error);
return callback('unknown error');
}
}).pipe(zlib.createGunzip()).on('error', function(error) {
return callback("'" + path + "' is not a valid Ableton project");
}).pipe(concat(function(xml) {
var d;
d = cheerio.load(xml);
console.log(d);
return callback(d);
}));
global.path = this.path;
return fs.createReadStream(path).on('error', fsError(callback)).pipe(zlib.createGunzip()).on('error', unzipError(callback)).pipe(concat(onLoad(callback)));
};
Ableton.prototype.write = function(data, callback) {
var builder, path, ws, xml;
var builder, ws, xml;
if (!data) {
callback("No data to write");
callback(new Error("No data to write"), null);
return;
}
builder = new Builder();
path = this.path;
global.path = this.path;
ws = fs.createWriteStream(path);
ws.on('error', function(error) {
switch (error.code) {
case 'ENOENT':
return callback("'" + path + "' does not exist");
case 'EISDIR':
return callback("'" + path + "' is a directory");
default:
console.log(error);
return callback('unknown error');
}
});
ws.on('error', fsError(callback));
xml = builder.buildObject(data);
return zlib.gzip(xml, function(error, data) {
return fs.writeFile(path, data, function(error) {
return callback(error);
return callback(error, null);
});

@@ -72,0 +73,0 @@ });

{
"name": "ableton",
"version": "0.0.3",
"version": "0.0.5",
"description": "Parser for Ableton Live's .als format",

@@ -20,4 +20,8 @@ "main": "ableton.js",

"devDependencies": {
"coffee-script": "^1.8.0"
"coffee-script": "^1.9.0"
},
"repository": {
"type": "git",
"url": "https://github.com/lavelle/ableton.git"
}
}

Sorry, the diff of this file is not supported yet

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