Comparing version 0.0.4 to 0.0.5
// Generated by CoffeeScript 1.4.0 | ||
(function() { | ||
var cache, fs, parseSrec, request; | ||
var block2srec, cache, fs, parseSrec, request, sprintf; | ||
@@ -9,2 +9,22 @@ fs = require('fs'); | ||
sprintf = require('sprintf').sprintf; | ||
module.exports.block2srec = block2srec = function(a, data) { | ||
var byte, s, sum, _i, _len; | ||
sum = data.length + 5; | ||
sum += a & 0xff; | ||
sum += (a >> 8) & 0xff; | ||
sum += (a >> 16) & 0xff; | ||
sum += (a >> 24) & 0xff; | ||
s = sprintf("S3%02X%08X", data.length + 5, a); | ||
for (_i = 0, _len = data.length; _i < _len; _i++) { | ||
byte = data[_i]; | ||
s += sprintf("%02X", byte); | ||
sum += byte; | ||
} | ||
sum = (~sum) & 0xff; | ||
s += sprintf("%02X", sum); | ||
return s; | ||
}; | ||
module.exports.parseSrec = parseSrec = function(data) { | ||
@@ -95,3 +115,3 @@ var addr, alen, b, boot, byte, dp, i, info, len, max, mem, min, s, srecs, type, _i, _j, _k, _len, _len1, _ref; | ||
module.exports.readSrecUrl = function(url, cb) { | ||
if (cache[url]) { | ||
if (false && cache[url]) { | ||
console.log("node-srec: from Cache Url: '" + url + "'"); | ||
@@ -103,6 +123,8 @@ return cb(cache[url]); | ||
if (!error && response.statusCode === 200) { | ||
console.log("got " + url + " " + response); | ||
cache[url] = parseSrec(body); | ||
return cb(cache[url]); | ||
} else { | ||
return cb([]); | ||
console.log("Error: cannot get " + url + "?? " + response); | ||
return cb("", "Error: cannot get " + url + " http-status:" + response.statusCode); | ||
} | ||
@@ -109,0 +131,0 @@ }); |
{ | ||
"name": "node-srec", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"description": "Motorola S-record library", | ||
@@ -5,0 +5,0 @@ "main": "node-srec.js", |
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
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
13160
9
206