OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 module filesystem; | 5 module filesystem; |
6 | 6 |
7 import "components/filesystem/public/interfaces/file.mojom"; | 7 import "components/filesystem/public/interfaces/file.mojom"; |
8 import "components/filesystem/public/interfaces/types.mojom"; | 8 import "components/filesystem/public/interfaces/types.mojom"; |
9 | 9 |
10 // This interface provides access to a directory in a "file system", providing | 10 // This interface provides access to a directory in a "file system", providing |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 // Returns true if |path| exists. | 45 // Returns true if |path| exists. |
46 Exists(string path) => (FileError error, bool exists); | 46 Exists(string path) => (FileError error, bool exists); |
47 | 47 |
48 // Returns true if |path| is writable. | 48 // Returns true if |path| is writable. |
49 IsWritable(string path) => (FileError error, bool is_writable); | 49 IsWritable(string path) => (FileError error, bool is_writable); |
50 | 50 |
51 // Opens a file descriptor on this directory and calls | 51 // Opens a file descriptor on this directory and calls |
52 // fsync()/FlushFileBuffers(). | 52 // fsync()/FlushFileBuffers(). |
53 Flush() => (FileError error); | 53 Flush() => (FileError error); |
54 | 54 |
| 55 // Reads the contents of an entire file. |
| 56 ReadEntireFile(string path) => (FileError error, array<uint8> data); |
| 57 |
| 58 // Writes |data| to |path|, overwriting the file if it already exists. |
| 59 WriteFile(string path, array<uint8> data) => (FileError error); |
| 60 |
55 // TODO(vtl): directory "streaming"? | 61 // TODO(vtl): directory "streaming"? |
56 // TODO(vtl): "make root" (i.e., prevent cd-ing, etc., to parent); note that | 62 // TODO(vtl): "make root" (i.e., prevent cd-ing, etc., to parent); note that |
57 // this would require a much more complicated implementation (e.g., it needs | 63 // this would require a much more complicated implementation (e.g., it needs |
58 // to be "inherited" by OpenDirectory(), and the enforcement needs to be valid | 64 // to be "inherited" by OpenDirectory(), and the enforcement needs to be valid |
59 // even if the opened directory is subsequently moved -- e.g., closer to the | 65 // even if the opened directory is subsequently moved -- e.g., closer to the |
60 // "root") | 66 // "root") |
61 // TODO(vtl): Add a "watch"? | 67 // TODO(vtl): Add a "watch"? |
62 }; | 68 }; |
OLD | NEW |