How to use the @jupyterlab/docregistry.DocumentRegistry.defaultDirectoryFileType function in @jupyterlab/docregistry

To help you get started, we’ve selected a few @jupyterlab/docregistry examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jupyterlab / jupyterlab-google-drive / src / contents.ts View on Github external
content: modelFactory.createNew().toJSON(),
        mimetype: fileType.mimeTypes[0],
        format: fileType.fileFormat
      };
    } else if (contentType === 'file') {
      fileType = DocumentRegistry.defaultTextFileType;
      ext = ext || fileType.extensions[0];
      baseName = 'untitled';
      model = {
        type: fileType.contentType,
        content: '',
        mimetype: fileType.mimeTypes[0],
        format: fileType.fileFormat
      };
    } else if (contentType === 'directory') {
      fileType = DocumentRegistry.defaultDirectoryFileType;
      ext = ext || '';
      baseName = 'Untitled Folder';
      model = {
        type: fileType.contentType,
        content: [],
        format: fileType.fileFormat
      };
    } else {
      throw new Error('Unrecognized type ' + contentType);
    }

    const name = await this._getNewFilename(path, ext, baseName);
    const m = { ...model, name };
    path = PathExt.join(path, name);
    const contents = await drive.uploadFile(
      path,
github jupyterlab / jupyterlab-google-drive / src / drive.ts View on Github external
* Type stub for a Team Drive resource.
 */
export type TeamDriveResource = gapi.client.drive.TeamDrive;

/**
 * An API response which may be paginated.
 */
type PaginatedResponse =
  | gapi.client.drive.FileList
  | gapi.client.drive.TeamDriveList
  | gapi.client.drive.RevisionList;

/**
 * Alias for directory IFileType.
 */
const directoryFileType = DocumentRegistry.defaultDirectoryFileType;

/**
 * The name of the dummy "Shared with me" folder.
 */
const SHARED_DIRECTORY = 'Shared with me';

/**
 * The path of the dummy pseudo-root folder.
 */
const COLLECTIONS_DIRECTORY = '';

/**
 * A dummy files resource for the "Shared with me" folder.
 */
const SHARED_DIRECTORY_RESOURCE: FileResource = {
  kind: 'dummy',