26 lines
563 B
JavaScript
26 lines
563 B
JavaScript
|
#!/usr/bin/env node
|
||
|
|
||
|
import * as network from '../src/tam/network.js';
|
||
|
import fs from 'fs/promises';
|
||
|
|
||
|
const lines = ['1', '2', '3', '4'];
|
||
|
const data = await network.fetch(lines);
|
||
|
|
||
|
await fs.writeFile(
|
||
|
new URL("../src/tam/network.json", import.meta.url),
|
||
|
JSON.stringify(
|
||
|
data,
|
||
|
(_, value) =>
|
||
|
{
|
||
|
if (value instanceof Set)
|
||
|
{
|
||
|
// Convert sets to arrays for JSON representation
|
||
|
return Array.from(value.values());
|
||
|
}
|
||
|
|
||
|
return value;
|
||
|
},
|
||
|
4
|
||
|
)
|
||
|
);
|