-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathfile.js
70 lines (59 loc) · 1.88 KB
/
file.js
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/*
* Copyright (c) 2016-2017 Moddable Tech, Inc.
*
* This file is part of the Moddable SDK Runtime.
*
* The Moddable SDK Runtime is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The Moddable SDK Runtime is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with the Moddable SDK Runtime. If not, see <http://www.gnu.org/licenses/>.
*
*/
/*
file
*/
export class File @ "xs_file_destructor" {
constructor(dictionary) @ "xs_File";
read(type, count) @ "xs_file_read";
write(...items) @ "xs_file_write";
close() @ "xs_file_close";
get length() @ "xs_file_get_length";
get position() @ "xs_file_get_position";
set position() @ "xs_file_set_position";
static delete(path) @ "xs_file_delete";
static exists(path) @ "xs_file_exists";
static rename(path, name) @ "xs_file_rename";
};
export class Iterator @ "xs_file_iterator_destructor" {
constructor(path) @ "xs_File_Iterator";
next() @ "xs_file_iterator_next";
[Symbol.iterator]() {
return {
iterator: this,
next() {
const result = {value: this.iterator.next()};
result.done = undefined === result.value;
return result;
}
};
}
};
export class Directory {
static create(path) @ "xs_directory_create";
static delete(path) @ "xs_directory_delete";
};
export class System {
static config() @ "xs_file_system_config";
static info() @ "xs_file_system_info";
};
export default Object.freeze({
File, Iterator, System, Directory
});