Comparing version 0.0.3 to 0.0.5
@@ -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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
22776
7
1
66
1