main funcions fixes
This commit is contained in:
36
desktop-operator/node_modules/read-binary-file-arch/test.js
generated
vendored
Normal file
36
desktop-operator/node_modules/read-binary-file-arch/test.js
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
const { promises: fs } = require('fs');
|
||||
const path = require('path');
|
||||
const degit = require('degit');
|
||||
const { readBinaryFileArch } = require('.');
|
||||
|
||||
const samplesFolder = path.join(__dirname, 'samples');
|
||||
|
||||
async function before() {
|
||||
const emitter = degit('https://github.com/JonathanSalwan/binary-samples');
|
||||
emitter.on('info', console.debug);
|
||||
try {
|
||||
await emitter.clone(samplesFolder);
|
||||
} catch (error) {
|
||||
if (error.code !== 'DEST_NOT_EMPTY') {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function test() {
|
||||
await before();
|
||||
|
||||
const files = await fs.readdir(samplesFolder);
|
||||
for (const file of files) {
|
||||
const filePath = path.join(samplesFolder, file);
|
||||
|
||||
try {
|
||||
const arch = await readBinaryFileArch(filePath);
|
||||
console.log(`${arch}\t${file}`);
|
||||
} catch (error) {
|
||||
console.error(`${file}: ${error.message}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
test();
|
||||
Reference in New Issue
Block a user