mirror of
https://github.com/jupyter/notebook.git
synced 2025-04-12 14:00:27 +08:00
Clarify contents api further
This commit is contained in:
parent
24e4a2e4f5
commit
5280bf60a5
@ -81,7 +81,9 @@ model. There are three model types: **notebook**, **file**, and **directory**.
|
||||
- The ``format`` field is either ``"text"`` or ``"base64"``.
|
||||
- The ``mimetype`` field can be any mimetype string, but defaults to
|
||||
``text/plain`` for text-format models and
|
||||
``application/octet-stream`` for base64-format models.
|
||||
``application/octet-stream`` for base64-format models. For files with
|
||||
unknown mime types (e.g. unknown file extensions), this field may be
|
||||
`None`.
|
||||
- The ``content`` field is always of type ``unicode``. For text-format
|
||||
file models, ``content`` simply contains the file's bytes after decoding
|
||||
as UTF-8. Non-text (``base64``) files are read as bytes, base64 encoded,
|
||||
@ -100,9 +102,10 @@ model. There are three model types: **notebook**, **file**, and **directory**.
|
||||
In certain circumstances, we don't need the full content of an entity to
|
||||
complete a Contents API request. In such cases, we omit the ``content``, and
|
||||
``format`` keys from the model, and the default values for the ``mimetype``
|
||||
field. This most commonly occurs when listing a directory, in which
|
||||
circumstance we represent files within the directory as content-less models
|
||||
to avoid having to recursively traverse and serialize the entire filesystem.
|
||||
field (see above). This most commonly occurs when listing a directory, in
|
||||
which circumstance we represent files within the directory as content-less
|
||||
models to avoid having to recursively traverse and serialize the entire
|
||||
filesystem.
|
||||
|
||||
**Sample Models**
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user