ArchiveBox/docs/apidocs/archivebox/archivebox.misc.serve_static.md

17 KiB

{py:mod}archivebox.misc.serve_static

:allowtitles:

Module Contents

Classes

:class: autosummary longtable
:align: left

* - {py:obj}`_StreamingQueueWriter <archivebox.misc.serve_static._StreamingQueueWriter>`
  - ```{autodoc2-docstring} archivebox.misc.serve_static._StreamingQueueWriter
    :summary:
    ```
* - {py:obj}`RangedFileReader <archivebox.misc.serve_static.RangedFileReader>`
  - ```{autodoc2-docstring} archivebox.misc.serve_static.RangedFileReader
    :summary:
    ```

Functions

:class: autosummary longtable
:align: left

* - {py:obj}`_load_hash_map <archivebox.misc.serve_static._load_hash_map>`
  - ```{autodoc2-docstring} archivebox.misc.serve_static._load_hash_map
    :summary:
    ```
* - {py:obj}`_hash_for_path <archivebox.misc.serve_static._hash_for_path>`
  - ```{autodoc2-docstring} archivebox.misc.serve_static._hash_for_path
    :summary:
    ```
* - {py:obj}`_resolve_archive_path <archivebox.misc.serve_static._resolve_archive_path>`
  - ```{autodoc2-docstring} archivebox.misc.serve_static._resolve_archive_path
    :summary:
    ```
* - {py:obj}`_cache_policy <archivebox.misc.serve_static._cache_policy>`
  - ```{autodoc2-docstring} archivebox.misc.serve_static._cache_policy
    :summary:
    ```
* - {py:obj}`_render_mhtml_preview_document <archivebox.misc.serve_static._render_mhtml_preview_document>`
  - ```{autodoc2-docstring} archivebox.misc.serve_static._render_mhtml_preview_document
    :summary:
    ```
* - {py:obj}`_format_direntry_timestamp <archivebox.misc.serve_static._format_direntry_timestamp>`
  - ```{autodoc2-docstring} archivebox.misc.serve_static._format_direntry_timestamp
    :summary:
    ```
* - {py:obj}`_safe_zip_stem <archivebox.misc.serve_static._safe_zip_stem>`
  - ```{autodoc2-docstring} archivebox.misc.serve_static._safe_zip_stem
    :summary:
    ```
* - {py:obj}`_iter_visible_files <archivebox.misc.serve_static._iter_visible_files>`
  - ```{autodoc2-docstring} archivebox.misc.serve_static._iter_visible_files
    :summary:
    ```
* - {py:obj}`_build_directory_zip_response <archivebox.misc.serve_static._build_directory_zip_response>`
  - ```{autodoc2-docstring} archivebox.misc.serve_static._build_directory_zip_response
    :summary:
    ```
* - {py:obj}`_stream_ranged_file_async <archivebox.misc.serve_static._stream_ranged_file_async>`
  - ```{autodoc2-docstring} archivebox.misc.serve_static._stream_ranged_file_async
    :summary:
    ```
* - {py:obj}`_render_directory_index <archivebox.misc.serve_static._render_directory_index>`
  - ```{autodoc2-docstring} archivebox.misc.serve_static._render_directory_index
    :summary:
    ```
* - {py:obj}`_extract_markdown_candidate <archivebox.misc.serve_static._extract_markdown_candidate>`
  - ```{autodoc2-docstring} archivebox.misc.serve_static._extract_markdown_candidate
    :summary:
    ```
* - {py:obj}`_looks_like_markdown <archivebox.misc.serve_static._looks_like_markdown>`
  - ```{autodoc2-docstring} archivebox.misc.serve_static._looks_like_markdown
    :summary:
    ```
* - {py:obj}`_render_text_preview_document <archivebox.misc.serve_static._render_text_preview_document>`
  - ```{autodoc2-docstring} archivebox.misc.serve_static._render_text_preview_document
    :summary:
    ```
* - {py:obj}`_render_image_preview_document <archivebox.misc.serve_static._render_image_preview_document>`
  - ```{autodoc2-docstring} archivebox.misc.serve_static._render_image_preview_document
    :summary:
    ```
* - {py:obj}`_render_markdown_fallback <archivebox.misc.serve_static._render_markdown_fallback>`
  - ```{autodoc2-docstring} archivebox.misc.serve_static._render_markdown_fallback
    :summary:
    ```
* - {py:obj}`_render_markdown_document <archivebox.misc.serve_static._render_markdown_document>`
  - ```{autodoc2-docstring} archivebox.misc.serve_static._render_markdown_document
    :summary:
    ```
* - {py:obj}`_content_type_base <archivebox.misc.serve_static._content_type_base>`
  - ```{autodoc2-docstring} archivebox.misc.serve_static._content_type_base
    :summary:
    ```
* - {py:obj}`_is_risky_replay_document <archivebox.misc.serve_static._is_risky_replay_document>`
  - ```{autodoc2-docstring} archivebox.misc.serve_static._is_risky_replay_document
    :summary:
    ```
* - {py:obj}`_apply_archive_replay_headers <archivebox.misc.serve_static._apply_archive_replay_headers>`
  - ```{autodoc2-docstring} archivebox.misc.serve_static._apply_archive_replay_headers
    :summary:
    ```
* - {py:obj}`_is_asgi_request <archivebox.misc.serve_static._is_asgi_request>`
  - ```{autodoc2-docstring} archivebox.misc.serve_static._is_asgi_request
    :summary:
    ```
* - {py:obj}`serve_static_with_byterange_support <archivebox.misc.serve_static.serve_static_with_byterange_support>`
  - ```{autodoc2-docstring} archivebox.misc.serve_static.serve_static_with_byterange_support
    :summary:
    ```
* - {py:obj}`serve_static <archivebox.misc.serve_static.serve_static>`
  - ```{autodoc2-docstring} archivebox.misc.serve_static.serve_static
    :summary:
    ```
* - {py:obj}`parse_range_header <archivebox.misc.serve_static.parse_range_header>`
  - ```{autodoc2-docstring} archivebox.misc.serve_static.parse_range_header
    :summary:
    ```

Data

:class: autosummary longtable
:align: left

* - {py:obj}`_HASHES_CACHE <archivebox.misc.serve_static._HASHES_CACHE>`
  - ```{autodoc2-docstring} archivebox.misc.serve_static._HASHES_CACHE
    :summary:
    ```
* - {py:obj}`MARKDOWN_INLINE_LINK_RE <archivebox.misc.serve_static.MARKDOWN_INLINE_LINK_RE>`
  - ```{autodoc2-docstring} archivebox.misc.serve_static.MARKDOWN_INLINE_LINK_RE
    :summary:
    ```
* - {py:obj}`MARKDOWN_INLINE_IMAGE_RE <archivebox.misc.serve_static.MARKDOWN_INLINE_IMAGE_RE>`
  - ```{autodoc2-docstring} archivebox.misc.serve_static.MARKDOWN_INLINE_IMAGE_RE
    :summary:
    ```
* - {py:obj}`MARKDOWN_BOLD_RE <archivebox.misc.serve_static.MARKDOWN_BOLD_RE>`
  - ```{autodoc2-docstring} archivebox.misc.serve_static.MARKDOWN_BOLD_RE
    :summary:
    ```
* - {py:obj}`MARKDOWN_ITALIC_RE <archivebox.misc.serve_static.MARKDOWN_ITALIC_RE>`
  - ```{autodoc2-docstring} archivebox.misc.serve_static.MARKDOWN_ITALIC_RE
    :summary:
    ```
* - {py:obj}`HTML_TAG_RE <archivebox.misc.serve_static.HTML_TAG_RE>`
  - ```{autodoc2-docstring} archivebox.misc.serve_static.HTML_TAG_RE
    :summary:
    ```
* - {py:obj}`HTML_BODY_RE <archivebox.misc.serve_static.HTML_BODY_RE>`
  - ```{autodoc2-docstring} archivebox.misc.serve_static.HTML_BODY_RE
    :summary:
    ```
* - {py:obj}`RISKY_REPLAY_MIMETYPES <archivebox.misc.serve_static.RISKY_REPLAY_MIMETYPES>`
  - ```{autodoc2-docstring} archivebox.misc.serve_static.RISKY_REPLAY_MIMETYPES
    :summary:
    ```
* - {py:obj}`RISKY_REPLAY_EXTENSIONS <archivebox.misc.serve_static.RISKY_REPLAY_EXTENSIONS>`
  - ```{autodoc2-docstring} archivebox.misc.serve_static.RISKY_REPLAY_EXTENSIONS
    :summary:
    ```
* - {py:obj}`RISKY_REPLAY_MARKERS <archivebox.misc.serve_static.RISKY_REPLAY_MARKERS>`
  - ```{autodoc2-docstring} archivebox.misc.serve_static.RISKY_REPLAY_MARKERS
    :summary:
    ```

API

:canonical: archivebox.misc.serve_static._HASHES_CACHE
:type: dict[pathlib.Path, tuple[float, dict[str, str]]]
:value: >
   None

```{autodoc2-docstring} archivebox.misc.serve_static._HASHES_CACHE
```

:canonical: archivebox.misc.serve_static._load_hash_map

```{autodoc2-docstring} archivebox.misc.serve_static._load_hash_map
```
:canonical: archivebox.misc.serve_static._hash_for_path

```{autodoc2-docstring} archivebox.misc.serve_static._hash_for_path
```
:canonical: archivebox.misc.serve_static._resolve_archive_path

```{autodoc2-docstring} archivebox.misc.serve_static._resolve_archive_path
```
:canonical: archivebox.misc.serve_static._cache_policy

```{autodoc2-docstring} archivebox.misc.serve_static._cache_policy
```
:canonical: archivebox.misc.serve_static._render_mhtml_preview_document

```{autodoc2-docstring} archivebox.misc.serve_static._render_mhtml_preview_document
```
:canonical: archivebox.misc.serve_static._format_direntry_timestamp

```{autodoc2-docstring} archivebox.misc.serve_static._format_direntry_timestamp
```
:canonical: archivebox.misc.serve_static._safe_zip_stem

```{autodoc2-docstring} archivebox.misc.serve_static._safe_zip_stem
```
:canonical: archivebox.misc.serve_static._StreamingQueueWriter

```{autodoc2-docstring} archivebox.misc.serve_static._StreamingQueueWriter
```

```{rubric} Initialization
```

```{autodoc2-docstring} archivebox.misc.serve_static._StreamingQueueWriter.__init__
```

````{py:method} write(data: bytes) -> int
:canonical: archivebox.misc.serve_static._StreamingQueueWriter.write

```{autodoc2-docstring} archivebox.misc.serve_static._StreamingQueueWriter.write
```

````

````{py:method} tell() -> int
:canonical: archivebox.misc.serve_static._StreamingQueueWriter.tell

```{autodoc2-docstring} archivebox.misc.serve_static._StreamingQueueWriter.tell
```

````

````{py:method} flush() -> None
:canonical: archivebox.misc.serve_static._StreamingQueueWriter.flush

```{autodoc2-docstring} archivebox.misc.serve_static._StreamingQueueWriter.flush
```

````

````{py:method} close() -> None
:canonical: archivebox.misc.serve_static._StreamingQueueWriter.close

```{autodoc2-docstring} archivebox.misc.serve_static._StreamingQueueWriter.close
```

````

````{py:method} writable() -> bool
:canonical: archivebox.misc.serve_static._StreamingQueueWriter.writable

```{autodoc2-docstring} archivebox.misc.serve_static._StreamingQueueWriter.writable
```

````

````{py:method} seekable() -> bool
:canonical: archivebox.misc.serve_static._StreamingQueueWriter.seekable

```{autodoc2-docstring} archivebox.misc.serve_static._StreamingQueueWriter.seekable
```

````

:canonical: archivebox.misc.serve_static._iter_visible_files

```{autodoc2-docstring} archivebox.misc.serve_static._iter_visible_files
```
:canonical: archivebox.misc.serve_static._build_directory_zip_response

```{autodoc2-docstring} archivebox.misc.serve_static._build_directory_zip_response
```
:canonical: archivebox.misc.serve_static._stream_ranged_file_async
:async:

```{autodoc2-docstring} archivebox.misc.serve_static._stream_ranged_file_async
```
:canonical: archivebox.misc.serve_static._render_directory_index

```{autodoc2-docstring} archivebox.misc.serve_static._render_directory_index
```
:canonical: archivebox.misc.serve_static.MARKDOWN_INLINE_LINK_RE
:value: >
   'compile(...)'

```{autodoc2-docstring} archivebox.misc.serve_static.MARKDOWN_INLINE_LINK_RE
```

:canonical: archivebox.misc.serve_static.MARKDOWN_INLINE_IMAGE_RE
:value: >
   'compile(...)'

```{autodoc2-docstring} archivebox.misc.serve_static.MARKDOWN_INLINE_IMAGE_RE
```

:canonical: archivebox.misc.serve_static.MARKDOWN_BOLD_RE
:value: >
   'compile(...)'

```{autodoc2-docstring} archivebox.misc.serve_static.MARKDOWN_BOLD_RE
```

:canonical: archivebox.misc.serve_static.MARKDOWN_ITALIC_RE
:value: >
   'compile(...)'

```{autodoc2-docstring} archivebox.misc.serve_static.MARKDOWN_ITALIC_RE
```

:canonical: archivebox.misc.serve_static.HTML_TAG_RE
:value: >
   'compile(...)'

```{autodoc2-docstring} archivebox.misc.serve_static.HTML_TAG_RE
```

:canonical: archivebox.misc.serve_static.HTML_BODY_RE
:value: >
   'compile(...)'

```{autodoc2-docstring} archivebox.misc.serve_static.HTML_BODY_RE
```

:canonical: archivebox.misc.serve_static.RISKY_REPLAY_MIMETYPES
:value: >
   None

```{autodoc2-docstring} archivebox.misc.serve_static.RISKY_REPLAY_MIMETYPES
```

:canonical: archivebox.misc.serve_static.RISKY_REPLAY_EXTENSIONS
:value: >
   None

```{autodoc2-docstring} archivebox.misc.serve_static.RISKY_REPLAY_EXTENSIONS
```

:canonical: archivebox.misc.serve_static.RISKY_REPLAY_MARKERS
:value: >
   ('<!doctype html', '<html', '<svg')

```{autodoc2-docstring} archivebox.misc.serve_static.RISKY_REPLAY_MARKERS
```

:canonical: archivebox.misc.serve_static._extract_markdown_candidate

```{autodoc2-docstring} archivebox.misc.serve_static._extract_markdown_candidate
```
:canonical: archivebox.misc.serve_static._looks_like_markdown

```{autodoc2-docstring} archivebox.misc.serve_static._looks_like_markdown
```
:canonical: archivebox.misc.serve_static._render_text_preview_document

```{autodoc2-docstring} archivebox.misc.serve_static._render_text_preview_document
```
:canonical: archivebox.misc.serve_static._render_image_preview_document

```{autodoc2-docstring} archivebox.misc.serve_static._render_image_preview_document
```
:canonical: archivebox.misc.serve_static._render_markdown_fallback

```{autodoc2-docstring} archivebox.misc.serve_static._render_markdown_fallback
```
:canonical: archivebox.misc.serve_static._render_markdown_document

```{autodoc2-docstring} archivebox.misc.serve_static._render_markdown_document
```
:canonical: archivebox.misc.serve_static._content_type_base

```{autodoc2-docstring} archivebox.misc.serve_static._content_type_base
```
:canonical: archivebox.misc.serve_static._is_risky_replay_document

```{autodoc2-docstring} archivebox.misc.serve_static._is_risky_replay_document
```
:canonical: archivebox.misc.serve_static._apply_archive_replay_headers

```{autodoc2-docstring} archivebox.misc.serve_static._apply_archive_replay_headers
```
:canonical: archivebox.misc.serve_static._is_asgi_request

```{autodoc2-docstring} archivebox.misc.serve_static._is_asgi_request
```
:canonical: archivebox.misc.serve_static.serve_static_with_byterange_support

```{autodoc2-docstring} archivebox.misc.serve_static.serve_static_with_byterange_support
```
:canonical: archivebox.misc.serve_static.serve_static

```{autodoc2-docstring} archivebox.misc.serve_static.serve_static
```
:canonical: archivebox.misc.serve_static.parse_range_header

```{autodoc2-docstring} archivebox.misc.serve_static.parse_range_header
```
:canonical: archivebox.misc.serve_static.RangedFileReader

```{autodoc2-docstring} archivebox.misc.serve_static.RangedFileReader
```

```{rubric} Initialization
```

```{autodoc2-docstring} archivebox.misc.serve_static.RangedFileReader.__init__
```

````{py:attribute} block_size
:canonical: archivebox.misc.serve_static.RangedFileReader.block_size
:value: >
   8192

```{autodoc2-docstring} archivebox.misc.serve_static.RangedFileReader.block_size
```

````

````{py:method} __iter__()
:canonical: archivebox.misc.serve_static.RangedFileReader.__iter__

```{autodoc2-docstring} archivebox.misc.serve_static.RangedFileReader.__iter__
```

````

````{py:method} close()
:canonical: archivebox.misc.serve_static.RangedFileReader.close

```{autodoc2-docstring} archivebox.misc.serve_static.RangedFileReader.close
```

````