-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: added recursive directory walking
- Loading branch information
1 parent
f364d20
commit f10e844
Showing
7 changed files
with
119 additions
and
25 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { AbstractError } from '@matrixai/errors'; | ||
|
||
class ErrorVirtualTar<T> extends AbstractError<T> { | ||
static description = 'VirtualTar errors'; | ||
} | ||
|
||
class ErrorVirtualTarUndefinedBehaviour<T> extends ErrorVirtualTar<T> { | ||
static description = 'You should never see this error'; | ||
} | ||
|
||
class ErrorVirtualTarInvalidFileName<T> extends ErrorVirtualTar<T> { | ||
static description = 'The provided file name is invalid'; | ||
} | ||
|
||
export { | ||
ErrorVirtualTar, | ||
ErrorVirtualTarUndefinedBehaviour, | ||
ErrorVirtualTarInvalidFileName, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,19 @@ | ||
// 0 = FILE | ||
// 5 = DIRECTORY | ||
type TarType = '0' | '5'; | ||
import type { Stats } from 'fs'; | ||
|
||
export { TarType }; | ||
// FIXME: Using 0s and 5s for files and directories isn't a good way to handle | ||
// this. I need to make it simpler so that I can assign and test using strings. | ||
// A potential solution is enums, but they don't work with types, so it's a bit | ||
// weird. | ||
type TarFile = '0'; | ||
|
||
type TarDirectory = '5'; | ||
|
||
type TarType = TarFile | TarDirectory; | ||
|
||
type DirectoryContent = { | ||
path: string; | ||
stat: Stats; | ||
type: TarType; | ||
}; | ||
|
||
export type { TarFile, TarDirectory, TarType, DirectoryContent }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import * as errors from './errors'; | ||
|
||
function never(message: string): never { | ||
throw new errors.ErrorVirtualTarUndefinedBehaviour(message); | ||
} | ||
|
||
export { never }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,9 @@ | ||
import { writeArchive } from '@/Generator'; | ||
|
||
describe('index', () => { | ||
test('test', async () => { | ||
test.skip('test', async () => { | ||
await expect( | ||
writeArchive( | ||
'/home/aryanj/Downloads/tar/FILE.txt', | ||
'/home/aryanj/Downloads/tar/FILE.tar', | ||
), | ||
writeArchive('/home/aryanj/Downloads', '/home/aryanj/archive.tar'), | ||
).toResolve(); | ||
}); | ||
}, 60000); | ||
}); |