@@ -30,7 +30,7 @@ export type Entry = File | Directory;
30
30
export function generateFileContent (
31
31
uri : vscode . Uri ,
32
32
fileName : string ,
33
- sourceContent : Buffer
33
+ sourceContent : Uint8Array
34
34
) : { content : string [ ] ; enc : boolean } {
35
35
const sourceLines = sourceContent . length ? new TextDecoder ( ) . decode ( sourceContent ) . split ( "\n" ) : [ ] ;
36
36
const fileExt = fileName . split ( "." ) . pop ( ) . toLowerCase ( ) ;
@@ -104,7 +104,7 @@ export function generateFileContent(
104
104
}
105
105
}
106
106
return {
107
- content : [ sourceContent . toString ( "base64" ) ] ,
107
+ content : [ Buffer . from ( sourceContent ) . toString ( "base64" ) ] ,
108
108
enc : true ,
109
109
} ;
110
110
}
@@ -396,7 +396,7 @@ export class FileSystemProvider implements vscode.FileSystemProvider {
396
396
397
397
public writeFile (
398
398
uri : vscode . Uri ,
399
- content : Buffer ,
399
+ content : Uint8Array ,
400
400
options : {
401
401
create : boolean ;
402
402
overwrite : boolean ;
@@ -659,11 +659,7 @@ export class FileSystemProvider implements vscode.FileSystemProvider {
659
659
const newCsp = newParams . has ( "csp" ) && [ "" , "1" ] . includes ( newParams . get ( "csp" ) ) ;
660
660
const newFileName = newCsp ? newUri . path : newUri . path . slice ( 1 ) . replace ( / \/ / g, "." ) ;
661
661
// Generate content for the new file
662
- const newContent = generateFileContent (
663
- newUri ,
664
- newFileName ,
665
- Buffer . from ( await vscode . workspace . fs . readFile ( oldUri ) )
666
- ) ;
662
+ const newContent = generateFileContent ( newUri , newFileName , await vscode . workspace . fs . readFile ( oldUri ) ) ;
667
663
if ( newFileStat ) {
668
664
// We're overwriting an existing file so prompt the user to check it out
669
665
await fireOtherStudioAction ( OtherStudioAction . AttemptedEdit , newUri ) ;
0 commit comments