30 lines
		
	
	
		
			677 B
		
	
	
	
		
			JavaScript
		
	
	
		
			Executable File
		
	
	
			
		
		
	
	
			30 lines
		
	
	
		
			677 B
		
	
	
	
		
			JavaScript
		
	
	
		
			Executable File
		
	
	
| #!/usr/bin/env node
 | |
| 
 | |
| const network = require('../back/data/network');
 | |
| const path = require('path');
 | |
| const fs = require('fs');
 | |
| 
 | |
| (async () =>
 | |
| {
 | |
|     const lines = ['1', '2', '3', '4'];
 | |
|     const data = await network.fetch(lines);
 | |
| 
 | |
|     fs.writeFileSync(
 | |
|         path.join(__dirname, '../back/data/network.json'),
 | |
|         JSON.stringify(
 | |
|             data,
 | |
|             (_, value) =>
 | |
|             {
 | |
|                 if (value instanceof Set)
 | |
|                 {
 | |
|                     // Convert sets to arrays for JSON representation
 | |
|                     return Array.from(value.values());
 | |
|                 }
 | |
| 
 | |
|                 return value;
 | |
|             },
 | |
|             4
 | |
|         )
 | |
|     );
 | |
| })();
 |