@@ -36,8 +36,8 @@ function getModuleNameFromBase(path: string): string {
3636 * * {@link getObject} and {@link storeObject} operate on JSON objects. Each object
3737 * has a type.
3838 *
39- * * {@link getFile} and {@link storeFile} operates on files. Each file has a MIME
40- * type.
39+ * * {@link getFile} and {@link storeFile} operates on files. Each file has a
40+ * content/MIME type.
4141 *
4242 * * {@link getAll} returns all objects or files for the given folder path.
4343 *
@@ -436,8 +436,10 @@ export class BaseClient {
436436 *
437437 * @returns An object containing the content type as well as the file's content:
438438 *
439- * * `mimeType`<br>
440- * String representing the MIME Type of the document.
439+ * * `contentType`<br>
440+ * String containing the MIME Type of the document. (Usually just the
441+ * MIME type, but can theoretically contain extra metadata such as `charset`
442+ * for example.)
441443 * * `data`<br>
442444 * Raw data of the document (either a string or an ArrayBuffer)
443445 *
@@ -446,13 +448,12 @@ export class BaseClient {
446448 *
447449 * ```js
448450 * client.getFile('path/to/some/image').then(file => {
449- * const blob = new Blob([file.data], { type: file.mimeType });
451+ * const blob = new Blob([file.data], { type: file.contentType });
450452 * const targetElement = document.findElementById('my-image-element');
451453 * targetElement.src = window.URL.createObjectURL(blob);
452454 * });
453455 * ```
454456 */
455- // TODO add real return type
456457 async getFile ( path : string , maxAge ?: false | number ) : Promise < unknown > {
457458 if ( typeof path !== 'string' ) {
458459 return Promise . reject ( 'Argument \'path\' of baseClient.getFile must be a string' ) ;
@@ -470,9 +471,9 @@ export class BaseClient {
470471 /**
471472 * Store raw data at a given path.
472473 *
473- * @param mimeType - MIME media type of the data being stored
474- * @param path - Path relative to the module root
475- * @param body - Raw data to store
474+ * @param contentType - Content type ( MIME media type) of the data being stored
475+ * @param path - Path relative to the module root
476+ * @param body - Raw data to store
476477 *
477478 * @returns A promise for the created/updated revision (ETag)
478479 *
@@ -499,9 +500,9 @@ export class BaseClient {
499500 * fileReader.readAsArrayBuffer(file);
500501 * ```
501502 */
502- async storeFile ( mimeType : string , path : string , body : string | ArrayBuffer | ArrayBufferView ) : Promise < string > {
503- if ( typeof mimeType !== 'string' ) {
504- return Promise . reject ( 'Argument \'mimeType \' of baseClient.storeFile must be a string' ) ;
503+ async storeFile ( contentType : string , path : string , body : string | ArrayBuffer | ArrayBufferView ) : Promise < string > {
504+ if ( typeof contentType !== 'string' ) {
505+ return Promise . reject ( 'Argument \'contentType \' of baseClient.storeFile must be a string' ) ;
505506 }
506507 if ( typeof path !== 'string' ) {
507508 return Promise . reject ( 'Argument \'path\' of baseClient.storeFile must be a string' ) ;
@@ -513,7 +514,7 @@ export class BaseClient {
513514 console . warn ( 'WARNING: Editing a document to which only read access (\'r\') was claimed' ) ;
514515 }
515516
516- return this . storage . put ( this . makePath ( path ) , body , mimeType ) . then ( ( r : QueuedRequestResponse ) => {
517+ return this . storage . put ( this . makePath ( path ) , body , contentType ) . then ( ( r : QueuedRequestResponse ) => {
517518 if ( r . statusCode === 200 || r . statusCode === 201 ) {
518519 return r . revision ;
519520 } else {
0 commit comments