1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
use js_sys::{JsString, Object};
use wasm_bindgen::prelude::*;

#[wasm_bindgen(module = "fs")]
extern {
    #[wasm_bindgen(extends = Object)]
    #[derive(Clone, Debug)]
    pub type Dirent;

    // FIXME: event overloads

    //******************//
    // Instance Methods //
    //******************//

    #[wasm_bindgen(method, js_name = "isFile")]
    pub fn is_file(this: &Dirent) -> bool;

    #[wasm_bindgen(method, js_name = "isDirectory")]
    pub fn is_directory(this: &Dirent) -> bool;

    #[wasm_bindgen(method, js_name = "isBlockDevice")]
    pub fn is_block_device(this: &Dirent) -> bool;

    #[wasm_bindgen(method, js_name = "isCharacterDevice")]
    pub fn is_character_device(this: &Dirent) -> bool;

    #[wasm_bindgen(method, js_name = "isSymbolic")]
    pub fn is_symbolic_link(this: &Dirent) -> bool;

    #[wasm_bindgen(method, js_name = "isFIFO")]
    pub fn is_fifo(this: &Dirent) -> bool;

    #[wasm_bindgen(method, js_name = "isSocket")]
    pub fn is_socket(this: &Dirent) -> bool;

    //*********************//
    // Instance Properties //
    //*********************//

    #[wasm_bindgen(method, getter)]
    pub fn name(this: &Dirent) -> JsString;
}