Skip to content

Commit

Permalink
more robust readfile
Browse files Browse the repository at this point in the history
  • Loading branch information
gfwilliams committed Aug 3, 2023
1 parent 2328a68 commit b8813ab
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion js/comms.js
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,8 @@ const Comms = {
const CHUNKSIZE = 384;
return Comms.readTextBlock(`\x03\x10(function() {
var s = require("Storage").read(${JSON.stringify(filename)});
Bluetooth.println(((s.length+2)/3)<<2); // estimate file size
if (s===undefined) s="";
Bluetooth.println(((s.length+2)/3)<<2);
for (var i=0;i<s.length;i+=${CHUNKSIZE}) Bluetooth.print(btoa(s.substr(i,${CHUNKSIZE})));
Bluetooth.print("\xFF");
})()\n`).then(text => {
Expand Down

0 comments on commit b8813ab

Please sign in to comment.