Skip to content

inquire() ​

js
const answers = await inquire(options);

Creates one browser form session and resolves with an object keyed by question name.

Options ​

PropertyTypeDescription
titlestringForm title. Defaults to Complete this form.
questionsQuestion[]One or more questions.
openbooleanOpen the default browser. Defaults to true.
onOpen(url) => voidCalled with the local session URL.
timeoutnumberOptional timeout in milliseconds.

The returned promise rejects when the user cancels the form, the session times out, or the server closes before submission.

Example ​

js
const answers = await inquire({
  open: false,
  onOpen: (url) => console.log(`Open ${url}`),
  questions: [{ name: 'email', message: 'Email', required: true }]
});

Released under the MIT License.