GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — perf: stream bundled OpenAPI file instead of sending it wholesale (#361) · readmeio/rdme@8fbf131

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • config
    • default.js
  • package-lock.json
  • package.json
  • src/cmds
    • openapi.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎config/default.js‎

Copy file name to clipboard
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module.exports = {
22
// eslint-disable-next-line global-require
33
cli: require('../package.json').name,
4-
host: 'https://dash.readme.io',
4+
host: 'https://dash.readme.com',
55
hub: 'https://{project}.readme.io',
66
};
Collapse file

‎package-lock.json‎

Copy file name to clipboardExpand all lines: package-lock.json
+41-5Lines changed: 41 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Collapse file

‎package.json‎

Copy file name to clipboardExpand all lines: package.json
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@
5151
"parse-link-header": "^1.0.1",
5252
"read": "^1.0.7",
5353
"semver": "^7.0.0",
54-
"table-layout": "^1.0.0"
54+
"table-layout": "^1.0.0",
55+
"tmp-promise": "^3.0.2"
5556
},
5657
"devDependencies": {
5758
"@readme/eslint-config": "^6.0.0",
Collapse file

‎src/cmds/openapi.js‎

Copy file name to clipboardExpand all lines: src/cmds/openapi.js
+8-1Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ const { getProjectVersion } = require('../lib/versionSelect');
1010
const fetch = require('node-fetch');
1111
const FormData = require('form-data');
1212
const parse = require('parse-link-header');
13+
const { file: tmpFile } = require('tmp-promise');
1314

1415
exports.command = 'openapi';
1516
exports.usage = 'openapi [file] [options]';
@@ -117,8 +118,14 @@ exports.run = async function (opts) {
117118
return Promise.reject(err);
118119
});
119120

121+
// Create a temporary file to write the bundled spec to,
122+
// which we will then stream into the form data body
123+
const { path } = await tmpFile({ prefix: 'rdme-openapi-', postfix: '.json' });
124+
await fs.writeFileSync(path, bundledSpec);
125+
const stream = fs.createReadStream(path);
126+
120127
const formData = new FormData();
121-
formData.append('spec', bundledSpec);
128+
formData.append('spec', stream);
122129

123130
const options = {
124131
headers: cleanHeaders(key, {

0 commit comments

Comments
0 (0)
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.