You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When fs.writeFileSync () is invoked with a non-legal path ( for example a path longer than the underlying platform path limit, which might be different in each operating system), it throws an error ENAMETOOLONG, name too long.
This exception crashes the current execution of the code.
Adding a try-catch block when fs.writeFileSync () is invoked and log the error.
Add a check for the path before invoking the function.
Option 2 seems to be tricky since we would need to know,somehow, what is the path limit of the underlying operating system, then we need to do an input validation for the path to see if it is not longer than the limit.
According to the documentation fs.writeFileSync () does not return nothing.
The text was updated successfully, but these errors were encountered:
it.only'Path too long unhandled exception', ->content= (20).random_Letters();
tempFile='./src'+ (250).random_Letters()
trycontent.saveAs(tempFile)
tempFile.length.assert_Is(255)
catch error
error.code.assert_Is('ENAMdETOOLONG')
error.toString().assert_Contains('Error: ENAMETOOLONG, name too long')
When fs.writeFileSync () is invoked with a non-legal path ( for example a path longer than the underlying platform path limit, which might be different in each operating system), it throws an error ENAMETOOLONG, name too long.
This exception crashes the current execution of the code.
There are two ways to fix this :
Option 2 seems to be tricky since we would need to know,somehow, what is the path limit of the underlying operating system, then we need to do an input validation for the path to see if it is not longer than the limit.
According to the documentation fs.writeFileSync () does not return nothing.
The text was updated successfully, but these errors were encountered: