mirror of
https://github.com/Kong/insomnia
synced 2024-11-07 22:30:15 +00:00
23 lines
403 B
JavaScript
23 lines
403 B
JavaScript
const fs = require('fs');
|
|
|
|
module.exports.templateTags = [
|
|
{
|
|
name: 'file',
|
|
displayName: 'File',
|
|
description: 'read contents from a file',
|
|
args: [
|
|
{
|
|
displayName: 'Choose File',
|
|
type: 'file',
|
|
},
|
|
],
|
|
run(context, path) {
|
|
if (!path) {
|
|
throw new Error('No file selected');
|
|
}
|
|
|
|
return fs.readFileSync(path, 'utf8');
|
|
},
|
|
},
|
|
];
|