Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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,
* 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',