MCPcopy
hub / github.com/Kong/insomnia / readFile

Method readFile

packages/insomnia/src/sync/git/mem-client.ts:88–111  ·  view source on GitHub ↗
(
    filePath: string,
    options: BufferEncoding | { encoding?: BufferEncoding } = {},
  )

Source from the content-addressed store, hash-verified

86 }
87
88 async readFile(
89 filePath: string,
90 options: BufferEncoding | { encoding?: BufferEncoding } = {},
91 ) {
92 filePath = path.normalize(filePath);
93
94 if (typeof options === 'string') {
95 options = {
96 encoding: options,
97 };
98 }
99
100 const encoding = options ? options.encoding : null;
101
102 const entry = this._assertFile(filePath);
103
104 const raw = Buffer.from(entry.contents, 'base64');
105
106 if (encoding) {
107 return raw.toString(encoding);
108 } else {
109 return raw;
110 }
111 }
112
113 async writeFile(
114 filePath: string,

Callers 15

lintSpecificationFunction · 0.45
readAndInsertDocFunction · 0.45
insomniaAdapterFunction · 0.45
_parseFileMethod · 0.45
curlRequestFunction · 0.45
openWebSocketConnectionFunction · 0.45
findManyFunction · 0.45
openCurlConnectionFunction · 0.45
findManyFunction · 0.45
ImportSpecButtonFunction · 0.45
handleUpdateFunction · 0.45
handleAddFileFunction · 0.45

Calls 3

_assertFileMethod · 0.95
normalizeMethod · 0.80
toStringMethod · 0.45

Tested by

no test coverage detected