(path: string, content: unknown)
| 220 | * TextFile: path (directory) / name (filename) / content |
| 221 | */ |
| 222 | export const writeFile = async (path: string, content: unknown): Promise<void> => { |
| 223 | const manager = getClientComManager(); |
| 224 | const contentStr = typeof content === 'string' ? content : JSON.stringify(content); |
| 225 | const file = toTextFile(path, contentStr); |
| 226 | const startTime = ts(); |
| 227 | const t0 = performance.now(); |
| 228 | await manager.putTextFilesByJSON({ files: [file] }); |
| 229 | console.info( |
| 230 | `[FileApi][${startTime}] writeFile "${file.path}/${file.name}" — ${(performance.now() - t0).toFixed(1)}ms`, |
| 231 | ); |
| 232 | }; |
| 233 | |
| 234 | /** |
| 235 | * Delete file |
no test coverage detected