b-gsdk 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/bin.js +27 -0
- package/dist/index.js +59 -0
- package/dist/util/format-error.js +16 -0
- package/dist/util/get-b-gsdk-directory-path.js +17 -0
- package/package.json +4 -7
- package/src/bin.ts +29 -0
- package/src/index.ts +18 -9
- package/src/util/format-error.ts +15 -0
- package/src/util/get-b-gsdk-directory-path.ts +12 -0
- package/tsconfig.json +2 -5
- package/bin/fsevents.node +0 -0
- package/bin/index.js +0 -165
- package/bin/worker.js +0 -35
package/bin/worker.js
DELETED
@@ -1,35 +0,0 @@
|
|
1
|
-
#!/usr/bin/env node
|
2
|
-
|
3
|
-
const fetch = require('node-fetch')
|
4
|
-
const shared = require('./shared')
|
5
|
-
const chunks = []
|
6
|
-
|
7
|
-
process.stdin.resume()
|
8
|
-
process.stdin.setEncoding('utf8')
|
9
|
-
|
10
|
-
process.stdin.on('data', function (chunk) {
|
11
|
-
chunks.push(chunk)
|
12
|
-
})
|
13
|
-
|
14
|
-
process.stdin.on('end', function () {
|
15
|
-
const input = JSON.parse(chunks.join(''))
|
16
|
-
const request = shared.deserializeRequest(fetch, ...input)
|
17
|
-
|
18
|
-
fetch(request)
|
19
|
-
.then(response => response.buffer()
|
20
|
-
.then(buffer => respond([
|
21
|
-
buffer.toString('base64'),
|
22
|
-
shared.serializeResponse(response)
|
23
|
-
]))
|
24
|
-
.catch(error => respond([
|
25
|
-
'',
|
26
|
-
shared.serializeResponse(response),
|
27
|
-
shared.serializeError(error)
|
28
|
-
]))
|
29
|
-
)
|
30
|
-
.catch(error => respond(shared.serializeError(error)))
|
31
|
-
})
|
32
|
-
|
33
|
-
function respond (message) {
|
34
|
-
console.log(JSON.stringify(message))
|
35
|
-
}
|