mirror of
https://github.com/Kong/insomnia
synced 2024-11-08 23:00:30 +00:00
16 lines
389 B
JavaScript
16 lines
389 B
JavaScript
// @flow
|
|
import path from 'path';
|
|
import os from 'os';
|
|
import mkdirp from 'mkdirp';
|
|
import fs from 'fs';
|
|
|
|
const writeProtoFile = async (src: string): Promise<string> => {
|
|
const root = path.join(os.tmpdir(), 'insomnia-grpc');
|
|
mkdirp.sync(root);
|
|
const p = path.join(root, `${Math.random()}.proto`);
|
|
await fs.promises.writeFile(p, src);
|
|
return p;
|
|
};
|
|
|
|
export default writeProtoFile;
|