Function SchemaBuilderPrompt

  • SchemaBuilderPrompt is an asynchronous function that guides the user through the process of creating a custom data schema. It allows the user to define keys and their corresponding data types, and then generates a specified quantity of data based on this schema.

    Parameters

    • OptionalDIR: string

      An optional directory path where the generated data file will be saved. If not provided, it defaults to the current working directory.

    Returns Promise<any>

    • Returns a promise that resolves with the generated schema object.
    // Example usage:
    SchemaBuilderPrompt('./output').then(schema => {
    console.log('Generated Schema:', schema);
    });

    // This will prompt the user to define a schema, generate data based on it, and save the data to a JSON file in the './output' directory.