Skip to content

Commit

Permalink
Temporarily removed the web FileSystem API adapter
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael-F-Bryan committed Nov 24, 2023
1 parent 3a89f23 commit b6726d9
Show file tree
Hide file tree
Showing 7 changed files with 4 additions and 818 deletions.
143 changes: 0 additions & 143 deletions src/fs/actors.rs

This file was deleted.

22 changes: 0 additions & 22 deletions src/fs/directory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ use std::sync::Arc;
use tracing::Instrument;
use virtual_fs::{AsyncReadExt, AsyncWriteExt, FileSystem};
use wasm_bindgen::{prelude::wasm_bindgen, JsCast, JsValue};
use web_sys::FileSystemDirectoryHandle;

use crate::{utils::Error, StringOrBytes};

Expand All @@ -20,27 +19,6 @@ impl Directory {
Directory::default()
}

/// Create a new [`Directory`] using the [File System API][mdn].
///
/// > **Important:** this API will only work inside a secure context.
///
/// Some ways a [`FileSystemDirectoryHandle`] can be created are...
///
/// - Using the [Origin private file system API][opfs]
/// - Calling [`window.showDirectoryPicker()`][sdp]
/// to access a file on the host machine (i.e. outside of the browser)
/// - From the [HTML Drag & Drop API][dnd] by calling [`DataTransferItem.getAsFileSystemHandle()`](https://developer.mozilla.org/en-US/docs/Web/API/DataTransferItem/getAsFileSystemHandle)
///
///
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/API/File_System_API
/// [dnd]: https://developer.mozilla.org/en-US/docs/Web/API/HTML_Drag_and_Drop_API
/// [sdp]: https://developer.mozilla.org/en-US/docs/Web/API/window/showDirectoryPicker
/// [opfs]: https://developer.mozilla.org/en-US/docs/Web/API/File_System_API/Origin_private_file_system
#[wasm_bindgen(js_name = "fromBrowser")]
pub fn from_browser(handle: FileSystemDirectoryHandle) -> Self {
Directory(Arc::new(crate::fs::web::spawn(handle)))
}

#[wasm_bindgen(js_name = "readDir")]
pub async fn read_dir(&self, mut path: String) -> Result<ListOfStrings, Error> {
if !path.starts_with('/') {
Expand Down
2 changes: 0 additions & 2 deletions src/fs/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
mod directory;
mod web;
mod actors;

pub use self::directory::Directory;

0 comments on commit b6726d9

Please sign in to comment.