# Interface: `IContents` [@jupyterlite/contents](../modules/jupyterlite_contents.md).IContents The interface for the contents service. ## Properties ### `ready` > > **`ready`**: `Promise`<`void`\> A promise that resolves after the contents have been full initialized. #### Defined in [packages/contents/src/tokens.ts:22](https://github.com/jupyterlite/jupyterlite/blob/c78cc8d/packages/contents/src/tokens.ts#L22) ## Methods ### `copy` > > **`copy`**(`path`, `toDir`): `Promise`<`IModel`\> Copy a file into a given directory. #### Parameters | Name | Type | Description | | :------ | :------ | :------ | | `path` | `string` | The original file path. | | `toDir` | `string` | The destination directory path. | #### Returns `Promise`<`IModel`\> A promise which resolves with the new contents model when the file is copied. #### Notes The server will select the name of the copied file. #### Defined in [packages/contents/src/tokens.ts:47](https://github.com/jupyterlite/jupyterlite/blob/c78cc8d/packages/contents/src/tokens.ts#L47) ### `createCheckpoint` > > **`createCheckpoint`**(`path`): `Promise`<`ICheckpointModel`\> Create a checkpoint for a file. #### Parameters | Name | Type | Description | | :------ | :------ | :------ | | `path` | `string` | The path of the file. | #### Returns `Promise`<`ICheckpointModel`\> A promise which resolves with the new checkpoint model when the checkpoint is created. #### Defined in [packages/contents/src/tokens.ts:100](https://github.com/jupyterlite/jupyterlite/blob/c78cc8d/packages/contents/src/tokens.ts#L100) ### `delete` > > **`delete`**(`path`): `Promise`<`void`\> Delete a file. #### Parameters | Name | Type | Description | | :------ | :------ | :------ | | `path` | `string` | The path to the file. | #### Returns `Promise`<`void`\> #### Defined in [packages/contents/src/tokens.ts:90](https://github.com/jupyterlite/jupyterlite/blob/c78cc8d/packages/contents/src/tokens.ts#L90) ### `deleteCheckpoint` > > **`deleteCheckpoint`**(`path`, `checkpointID`): `Promise`<`void`\> Delete a checkpoint for a file. #### Parameters | Name | Type | Description | | :------ | :------ | :------ | | `path` | `string` | The path of the file. | | `checkpointID` | `string` | The id of the checkpoint to delete. | #### Returns `Promise`<`void`\> A promise which resolves when the checkpoint is deleted. #### Defined in [packages/contents/src/tokens.ts:130](https://github.com/jupyterlite/jupyterlite/blob/c78cc8d/packages/contents/src/tokens.ts#L130) ### `get` > > **`get`**(`path`, `options?`): `Promise`<``null`` \| `IModel`\> Get a file or directory. #### Parameters | Name | Type | | :------ | :------ | | `path` | `string` | | `options?` | `IFetchOptions` | #### Returns `Promise`<``null`` \| `IModel`\> A promise which resolves with the file content. #### Defined in [packages/contents/src/tokens.ts:57](https://github.com/jupyterlite/jupyterlite/blob/c78cc8d/packages/contents/src/tokens.ts#L57) ### `listCheckpoints` > > **`listCheckpoints`**(`path`): `Promise`<`ICheckpointModel`[]\> List available checkpoints for a file. #### Parameters | Name | Type | Description | | :------ | :------ | :------ | | `path` | `string` | The path of the file. | #### Returns `Promise`<`ICheckpointModel`[]\> A promise which resolves with a list of checkpoint models for the file. #### Defined in [packages/contents/src/tokens.ts:110](https://github.com/jupyterlite/jupyterlite/blob/c78cc8d/packages/contents/src/tokens.ts#L110) ### `newUntitled` > > **`newUntitled`**(`options?`): `Promise`<``null`` \| `IModel`\> Create a new untitled file or directory in the specified directory path. #### Parameters | Name | Type | | :------ | :------ | | `options?` | `ICreateOptions` | #### Returns `Promise`<``null`` \| `IModel`\> A promise which resolves with the created file content when the file is created. #### Defined in [packages/contents/src/tokens.ts:31](https://github.com/jupyterlite/jupyterlite/blob/c78cc8d/packages/contents/src/tokens.ts#L31) ### `rename` > > **`rename`**(`oldLocalPath`, `newLocalPath`): `Promise`<`IModel`\> Rename a file or directory. #### Parameters | Name | Type | Description | | :------ | :------ | :------ | | `oldLocalPath` | `string` | The original file path. | | `newLocalPath` | `string` | The new file path. | #### Returns `Promise`<`IModel`\> A promise which resolves with the new file content model when the file is renamed. #### Defined in [packages/contents/src/tokens.ts:70](https://github.com/jupyterlite/jupyterlite/blob/c78cc8d/packages/contents/src/tokens.ts#L70) ### `restoreCheckpoint` > > **`restoreCheckpoint`**(`path`, `checkpointID`): `Promise`<`void`\> Restore a file to a known checkpoint state. #### Parameters | Name | Type | Description | | :------ | :------ | :------ | | `path` | `string` | The path of the file. | | `checkpointID` | `string` | The id of the checkpoint to restore. | #### Returns `Promise`<`void`\> A promise which resolves when the checkpoint is restored. #### Defined in [packages/contents/src/tokens.ts:120](https://github.com/jupyterlite/jupyterlite/blob/c78cc8d/packages/contents/src/tokens.ts#L120) ### `save` > > **`save`**(`path`, `options?`): `Promise`<``null`` \| `IModel`\> Save a file. #### Parameters | Name | Type | Description | | :------ | :------ | :------ | | `path` | `string` | The desired file path. | | `options?` | `Partial`<`IModel`\> | Optional overrides to the model. | #### Returns `Promise`<``null`` \| `IModel`\> A promise which resolves with the file content model when the file is saved. #### Defined in [packages/contents/src/tokens.ts:80](https://github.com/jupyterlite/jupyterlite/blob/c78cc8d/packages/contents/src/tokens.ts#L80)