11import { fromFileUrl , basename } from "jsr:@std/path@1" ;
22import { active_pkg , Path } from "brewkit" ;
3+ import { crc32 } from "https://deno.land/x/crc32/mod.ts" ;
4+
35
46export default async function (
5- url : string , opts : {
6- stripComponents : number | undefined ,
7- cache : boolean
8- } = {
9- stripComponents : url . endsWith ( ".zip" ) ? undefined : 1 ,
10- cache : true
11- }
7+ url : string ,
8+ stripComponents = url . endsWith ( ".zip" ) ? undefined : 1 ,
129) : Promise < void > {
1310 console . error ( "%c+" , "color:yellow" , "unarchiving:" , url ) ;
1411
1512 const root = new Path ( fromFileUrl ( import . meta. url ) ) . join ( "../../srcs" ) ;
1613 const ext = Path . root . join ( basename ( url ) ) . extname ( ) ;
17- const predownloaded_file = root . join ( active_pkg ! . project ) . mkdir ( "p" ) . join ( `v${ active_pkg ! . version } ${ ext } ` ) ;
14+ const checksum = crc32 ( url ) ;
15+ const predownloaded_file = root . join ( active_pkg ! . project ) . mkdir ( "p" ) . join ( `v${ active_pkg ! . version } _${ checksum } ${ ext } ` ) ;
1816
1917 const input = await ( async ( ) => {
2018 if ( ! predownloaded_file . isFile ( ) ) {
@@ -39,7 +37,7 @@ export default async function (
3937 } ) ( ) ;
4038
4139 if ( ! url . endsWith ( ".zip" ) ) {
42- const [ cmd , ...args ] = mktar ( url , opts . stripComponents ) ;
40+ const [ cmd , ...args ] = mktar ( url , stripComponents ) ;
4341 const tar = new Deno . Command ( cmd , {
4442 args : args ,
4543 stdin : "piped" ,
0 commit comments