@@ -9,7 +9,6 @@ import * as vscode from 'vscode'
99import * as nls from 'vscode-nls'
1010import * as pathutil from '../utilities/pathUtils'
1111import got , { OptionsOfTextResponseBody , RequestError } from 'got'
12- import { copyFile , readFile , remove , writeFile } from 'fs-extra'
1312import { isImageLambdaConfig } from '../../lambda/local/debugConfiguration'
1413import { getFamily , RuntimeFamily } from '../../lambda/models/samLambdaRuntime'
1514import { ExtContext } from '../extensions'
@@ -31,6 +30,7 @@ import { sleep } from '../utilities/timeoutUtils'
3130import { showMessageWithCancel } from '../utilities/messages'
3231import { ToolkitError , UnknownError } from '../errors'
3332import { SamCliError } from './cli/samCliInvokerUtils'
33+ import fs from '../fs/fs'
3434
3535const localize = nls . loadMessageBundle ( )
3636
@@ -259,7 +259,7 @@ async function invokeLambdaHandler(
259259 throw ToolkitError . chain ( err , msg )
260260 } finally {
261261 if ( config . sam ?. buildDir === undefined ) {
262- await remove ( config . templatePath )
262+ await fs . delete ( config . templatePath )
263263 }
264264 }
265265 }
@@ -307,7 +307,7 @@ export async function runLambdaFunction(
307307 const payload =
308308 config . eventPayloadFile === undefined
309309 ? undefined
310- : JSON . parse ( await readFile ( config . eventPayloadFile , { encoding : 'utf-8' } ) )
310+ : JSON . parse ( await fs . readFileAsString ( config . eventPayloadFile ) )
311311
312312 apiRequest = requestLocalApi ( timer , config . api ! , config . apiPort ! , payload )
313313 }
@@ -571,14 +571,14 @@ export async function makeJsonFiles(config: SamLaunchRequestArgs): Promise<void>
571571 if ( Object . keys ( configEnv ) . length !== 0 ) {
572572 const env = JSON . stringify ( getEnvironmentVariables ( makeResourceName ( config ) , configEnv ) )
573573 config . envFile = path . join ( config . baseBuildDir ! , 'env-vars.json' )
574- await writeFile ( config . envFile , env )
574+ await fs . writeFile ( config . envFile , env )
575575 }
576576
577577 // container-env-vars.json
578578 if ( config . containerEnvVars ) {
579579 config . containerEnvFile = path . join ( config . baseBuildDir ! , 'container-env-vars.json' )
580580 const containerEnv = JSON . stringify ( config . containerEnvVars )
581- await writeFile ( config . containerEnvFile , containerEnv )
581+ await fs . writeFile ( config . containerEnvFile , containerEnv )
582582 }
583583
584584 // event.json
@@ -594,12 +594,12 @@ export async function makeJsonFiles(config: SamLaunchRequestArgs): Promise<void>
594594 if ( payloadPath ) {
595595 const fullpath = tryGetAbsolutePath ( config . workspaceFolder , payloadPath )
596596 try {
597- JSON . parse ( await readFile ( fullpath , { encoding : 'utf-8' } ) )
597+ JSON . parse ( await fs . readFileAsString ( fullpath ) )
598598 } catch ( e ) {
599599 throw Error ( `Invalid JSON in payload file: ${ payloadPath } ` )
600600 }
601- await copyFile ( fullpath , config . eventPayloadFile )
601+ await fs . copy ( fullpath , config . eventPayloadFile )
602602 } else {
603- await writeFile ( config . eventPayloadFile , JSON . stringify ( payloadObj || { } ) )
603+ await fs . writeFile ( config . eventPayloadFile , JSON . stringify ( payloadObj || { } ) )
604604 }
605605}
0 commit comments