mirror of
https://github.com/Kong/insomnia
synced 2024-11-12 17:26:32 +00:00
23 lines
399 B
JavaScript
23 lines
399 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');
|
|
}
|
|
}
|
|
];
|