2020-01-14 23:19:26 +00:00
|
|
|
#!/usr/bin/env node
|
|
|
|
|
2020-07-19 20:13:26 +00:00
|
|
|
const network = require('../src/tam/network');
|
2020-01-14 23:19:26 +00:00
|
|
|
const path = require('path');
|
|
|
|
const fs = require('fs');
|
|
|
|
|
|
|
|
(async () =>
|
|
|
|
{
|
2020-01-15 17:17:49 +00:00
|
|
|
const lines = ['1', '2', '3', '4'];
|
2020-01-14 23:19:26 +00:00
|
|
|
const data = await network.fetch(lines);
|
|
|
|
|
|
|
|
fs.writeFileSync(
|
2020-07-19 20:13:26 +00:00
|
|
|
path.join(__dirname, '../src/tam/network.json'),
|
2020-01-16 18:10:30 +00:00
|
|
|
JSON.stringify(
|
|
|
|
data,
|
|
|
|
(_, value) =>
|
|
|
|
{
|
|
|
|
if (value instanceof Set)
|
|
|
|
{
|
|
|
|
// Convert sets to arrays for JSON representation
|
|
|
|
return Array.from(value.values());
|
|
|
|
}
|
|
|
|
|
|
|
|
return value;
|
|
|
|
},
|
2020-07-16 20:56:39 +00:00
|
|
|
4
|
2020-01-16 18:10:30 +00:00
|
|
|
)
|
2020-01-14 23:19:26 +00:00
|
|
|
);
|
|
|
|
})();
|