Skip to content

Instantly share code, notes, and snippets.

@rozek
Last active January 14, 2020 05:51
Show Gist options
  • Save rozek/60c91f8a2dad0e77eb948d3d0af673cc to your computer and use it in GitHub Desktop.
Save rozek/60c91f8a2dad0e77eb948d3d0af673cc to your computer and use it in GitHub Desktop.
Bangle.js: lists all files on the internal file system
const Storage = require('Storage');
print('compacting internal Storage...');
Storage.compact();
print('internal Storage report:');
print('-',Storage.getFree(),'bytes free');
print('- list of stored files');
let FileList = Storage.list();
for (let i = 0, l = FileList.length; i < l; i++) {
print(' -',FileList[i].replace(/[\x00-\x1F\x7F-\x9F]/g, function (Match) {
let CharCode = Match.charCodeAt(0);
return '\\x' + (CharCode < 16 ? '0' : '') + CharCode.toString(16);
}));
}
print('done');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment