@@ -91,8 +91,57 @@ export interface IFileSystemPathUtils {
91
91
92
92
export import FileType = vscode . FileType ;
93
93
export import FileStat = vscode . FileStat ;
94
+ export type ReadStream = fs . ReadStream ;
94
95
export type WriteStream = fs . WriteStream ;
95
96
97
+ // The low-level filesystem operations on which the extension depends.
98
+ export interface IRawFileSystem {
99
+ // Get information about a file (resolve symlinks).
100
+ stat ( filename : string ) : Promise < FileStat > ;
101
+ // Get information about a file (do not resolve synlinks).
102
+ lstat ( filename : string ) : Promise < FileStat > ;
103
+ // Change a file's permissions.
104
+ chmod ( filename : string , mode : string | number ) : Promise < void > ;
105
+ // Move the file to a different location (and/or rename it).
106
+ move ( src : string , tgt : string ) : Promise < void > ;
107
+
108
+ //***********************
109
+ // files
110
+
111
+ // Return the raw bytes of the given file.
112
+ readData ( filename : string ) : Promise < Buffer > ;
113
+ // Return the text of the given file (decoded from UTF-8).
114
+ readText ( filename : string ) : Promise < string > ;
115
+ // Write the given text to the file (UTF-8 encoded).
116
+ writeText ( filename : string , data : { } ) : Promise < void > ;
117
+ // Write the given text to the end of the file (UTF-8 encoded).
118
+ appendText ( filename : string , text : string ) : Promise < void > ;
119
+ // Copy a file.
120
+ copyFile ( src : string , dest : string ) : Promise < void > ;
121
+ // Delete a file.
122
+ rmfile ( filename : string ) : Promise < void > ;
123
+
124
+ //***********************
125
+ // directories
126
+
127
+ // Create the directory and any missing parent directories.
128
+ mkdirp ( dirname : string ) : Promise < void > ;
129
+ // Delete the directory and everything in it.
130
+ rmtree ( dirname : string ) : Promise < void > ;
131
+ // Return the contents of the directory.
132
+ listdir ( dirname : string ) : Promise < [ string , FileType ] [ ] > ;
133
+
134
+ //***********************
135
+ // not async
136
+
137
+ // Return the text of the given file (decoded from UTF-8).
138
+ readTextSync ( filename : string ) : string ;
139
+ // Create a streaming wrappr around an open file (for reading).
140
+ createReadStream ( filename : string ) : ReadStream ;
141
+ // Create a streaming wrappr around an open file (for writing).
142
+ createWriteStream ( filename : string ) : WriteStream ;
143
+ }
144
+
96
145
export const IFileSystem = Symbol ( 'IFileSystem' ) ;
97
146
export interface IFileSystem {
98
147
// path-related
@@ -106,8 +155,8 @@ export interface IFileSystem {
106
155
listdir ( dirname : string ) : Promise < [ string , FileType ] [ ] > ;
107
156
readFile ( filePath : string ) : Promise < string > ;
108
157
readData ( filePath : string ) : Promise < Buffer > ;
109
- writeFile ( filePath : string , data : { } , options ?: string | fsextra . WriteFileOptions ) : Promise < void > ;
110
- appendFile ( filename : string , data : { } ) : Promise < void > ;
158
+ writeFile ( filePath : string , text : string | Buffer , options ?: string | fsextra . WriteFileOptions ) : Promise < void > ;
159
+ appendFile ( filename : string , text : string | Buffer ) : Promise < void > ;
111
160
copyFile ( src : string , dest : string ) : Promise < void > ;
112
161
deleteFile ( filename : string ) : Promise < void > ;
113
162
chmod ( path : string , mode : string | number ) : Promise < void > ;
0 commit comments