Skip to content

Commit

Permalink
progress
Browse files Browse the repository at this point in the history
Signed-off-by: jace-roell <jace.roell@hotmail.com>
  • Loading branch information
jace-roell committed Oct 30, 2024
1 parent 4b5c6fc commit c87ee64
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
*.bin binary binary
*.jcl IBM-1047 IBM-1047
*.md UTF-8 UTF-8
*.txt UTF-8 IBM-1047
*.txt UTF-8 binary
18 changes: 11 additions & 7 deletions packages/zosfiles/src/methods/download/Download.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import { ZosFilesUtils } from "../../utils/ZosFilesUtils";
import { List } from "../list/List";
import { IDownloadOptions, IDownloadSingleOptions } from "./doc/IDownloadOptions";
import { CLIENT_PROPERTY } from "../../doc/types/ZosmfRestClientProperties";
import { Utilities } from "../utilities";
import { Tag, Utilities } from "../utilities";
import { IZosmfListResponse } from "../list/doc/IZosmfListResponse";
import { IDownloadDsmResult } from "./doc/IDownloadDsmResult";
import { IDownloadUssDirResult } from "./doc/IDownloadUssDirResult";
Expand Down Expand Up @@ -521,7 +521,16 @@ export class Download {

const writeStream = options.stream ?? IO.createWriteStream(destination);

// If data type is not defined by user, check for USS tags
//const remoteEncoding = options.attributes.getRemoteEncoding(ussFileName);
options.binary = options.attributes.getFileTransferMode(ussFileName, options.binary) === TransferMode.BINARY;
const localEncoding = options.attributes.getRemoteEncoding(ussFileName);

Check warning on line 526 in packages/zosfiles/src/methods/download/Download.ts

View check run for this annotation

Codecov / codecov/patch

packages/zosfiles/src/methods/download/Download.ts#L526

Added line #L526 was not covered by tests
// If attributes map was passed from handler then assign remote coding of the file to the download encoding
if(options.attributes && localEncoding != null && localEncoding !== Tag.BINARY )
{
options.encoding = options.attributes.getRemoteEncoding(ussFileName);

Check warning on line 530 in packages/zosfiles/src/methods/download/Download.ts

View check run for this annotation

Codecov / codecov/patch

packages/zosfiles/src/methods/download/Download.ts#L530

Added line #L530 was not covered by tests
}

// If data type is not defined by user via encoding flag or attributes file, check for USS tags
if (options.binary == null && options.encoding == null) {
await Utilities.applyTaggedEncoding(session, ussFileName, options);
}
Expand All @@ -531,11 +540,6 @@ export class Download {
ussFileName = ZosFilesUtils.sanitizeUssPathForRestCall(ussFileName);
const endpoint = posix.join(ZosFilesConstants.RESOURCE, ZosFilesConstants.RES_USS_FILES, ussFileName);

if(options.attributes)
{
options.encoding = options.attributes.getRemoteEncoding(ussFileName);
}

const reqHeaders: IHeaderContent[] = this.generateHeadersBasedOnOptions(options);

// Use specific options to mimic ZosmfRestClient.getStreamed()
Expand Down
2 changes: 1 addition & 1 deletion usstest.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
E@Q@U@�@�@I@h@Y@�����@Z|{[l@_@�@�@[@�@?
á { í ó ú ñ Ç ß 12345 §à£$% ^ Ý ~ $ # 

0 comments on commit c87ee64

Please sign in to comment.