@sasjs/core 4.3.2 → 4.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/base/mp_ds2csv.sas +2 -2
- package/base/mp_streamfile.sas +44 -34
- package/package.json +1 -1
package/base/mp_ds2csv.sas
CHANGED
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
numbers).
|
|
50
50
|
@param [out] outfile= The output filename - should be quoted.
|
|
51
51
|
@param [out] outref= (0) The output fileref (takes precedence if provided)
|
|
52
|
-
@param [in] outencoding= (0) The output encoding to use
|
|
52
|
+
@param [in] outencoding= (0) The (quoted) output encoding to use, eg `"UTF-8"`
|
|
53
53
|
@param [in] termstr= (CRLF) The line seperator to use. For SASJS, will
|
|
54
54
|
always be CRLF. Valid values:
|
|
55
55
|
@li CRLF
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
%if %index(&ds,.)=0 %then %let ds=WORK.&ds;
|
|
86
86
|
|
|
87
87
|
%if &outencoding=0 %then %let outencoding=;
|
|
88
|
-
%else %let outencoding=encoding
|
|
88
|
+
%else %let outencoding=encoding=&outencoding;
|
|
89
89
|
|
|
90
90
|
%if &outref=0 %then %let outloc=&outfile;
|
|
91
91
|
%else %let outloc=&outref;
|
package/base/mp_streamfile.sas
CHANGED
|
@@ -12,17 +12,16 @@
|
|
|
12
12
|
|
|
13
13
|
%mp_streamfile(contenttype=csv,inloc=/some/where.txt,outname=myfile.txt)
|
|
14
14
|
|
|
15
|
+
@param [in] contenttype= (TEXTS) Either TEXT, ZIP, CSV, EXCEL
|
|
16
|
+
@param [in] inloc= /path/to/file.ext to be sent
|
|
17
|
+
@param [in] inref= fileref of file to be sent (if provided, overrides `inloc`)
|
|
18
|
+
@param [out] outname= the name of the file, as downloaded by the browser
|
|
19
|
+
|
|
15
20
|
<h4> SAS Macros </h4>
|
|
16
21
|
@li mf_getplatform.sas
|
|
17
22
|
@li mp_binarycopy.sas
|
|
18
23
|
|
|
19
|
-
@param contenttype= Either TEXT, ZIP, CSV, EXCEL (default TEXT)
|
|
20
|
-
@param inloc= /path/to/file.ext to be sent
|
|
21
|
-
@param inref= fileref of file to be sent (if provided, overrides `inloc`)
|
|
22
|
-
@param outname= the name of the file, as downloaded by the browser
|
|
23
|
-
|
|
24
24
|
@author Allan Bowe
|
|
25
|
-
@source https://github.com/sasjs/core
|
|
26
25
|
|
|
27
26
|
**/
|
|
28
27
|
|
|
@@ -48,16 +47,16 @@ data _null_;
|
|
|
48
47
|
if xengine='STREAM' then call symputx('streamweb',1,'l');
|
|
49
48
|
run;
|
|
50
49
|
|
|
51
|
-
%if &contentype=
|
|
50
|
+
%if &contentype=CSV %then %do;
|
|
52
51
|
%if &platform=SASMETA and &streamweb=1 %then %do;
|
|
53
52
|
data _null_;
|
|
54
|
-
rc=stpsrv_header('Content-type','application/
|
|
53
|
+
rc=stpsrv_header('Content-type','application/csv');
|
|
55
54
|
rc=stpsrv_header('Content-disposition',"attachment; filename=&outname");
|
|
56
55
|
run;
|
|
57
56
|
%end;
|
|
58
57
|
%else %if &platform=SASVIYA %then %do;
|
|
59
|
-
filename _webout filesrvc parenturi="&SYS_JES_JOB_URI" name='_webout.
|
|
60
|
-
contenttype='application/
|
|
58
|
+
filename _webout filesrvc parenturi="&SYS_JES_JOB_URI" name='_webout.txt'
|
|
59
|
+
contenttype='application/csv'
|
|
61
60
|
contentdisp="attachment; filename=&outname";
|
|
62
61
|
%end;
|
|
63
62
|
%end;
|
|
@@ -75,56 +74,67 @@ run;
|
|
|
75
74
|
contentdisp="attachment; filename=&outname";
|
|
76
75
|
%end;
|
|
77
76
|
%end;
|
|
78
|
-
%else %if &contentype=
|
|
77
|
+
%else %if &contentype=HTML %then %do;
|
|
78
|
+
%if &platform=SASVIYA %then %do;
|
|
79
|
+
filename _webout filesrvc parenturi="&SYS_JES_JOB_URI" name="_webout.json"
|
|
80
|
+
contenttype="text/html";
|
|
81
|
+
%end;
|
|
82
|
+
%end;
|
|
83
|
+
%else %if &contentype=TEXT %then %do;
|
|
79
84
|
%if &platform=SASMETA and &streamweb=1 %then %do;
|
|
80
85
|
data _null_;
|
|
81
|
-
rc=stpsrv_header('Content-type',
|
|
82
|
-
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
|
|
86
|
+
rc=stpsrv_header('Content-type','application/text');
|
|
83
87
|
rc=stpsrv_header('Content-disposition',"attachment; filename=&outname");
|
|
84
88
|
run;
|
|
85
89
|
%end;
|
|
86
90
|
%else %if &platform=SASVIYA %then %do;
|
|
87
|
-
filename _webout filesrvc parenturi="&SYS_JES_JOB_URI" name='_webout.
|
|
88
|
-
contenttype=
|
|
89
|
-
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
|
|
91
|
+
filename _webout filesrvc parenturi="&SYS_JES_JOB_URI" name='_webout.txt'
|
|
92
|
+
contenttype='application/text'
|
|
90
93
|
contentdisp="attachment; filename=&outname";
|
|
91
94
|
%end;
|
|
92
95
|
%end;
|
|
93
|
-
%else %
|
|
96
|
+
%else %do;
|
|
97
|
+
%put %str(ERR)OR: Content Type &contenttype NOT SUPPORTED by &sysmacroname!;
|
|
98
|
+
%return;
|
|
99
|
+
%end;
|
|
100
|
+
%else %if &contentype=WOFF %then %do;
|
|
94
101
|
%if &platform=SASMETA and &streamweb=1 %then %do;
|
|
95
102
|
data _null_;
|
|
96
|
-
rc=stpsrv_header('Content-type','
|
|
97
|
-
rc=stpsrv_header('Content-disposition',"attachment; filename=&outname");
|
|
103
|
+
rc=stpsrv_header('Content-type','font/woff');
|
|
98
104
|
run;
|
|
99
105
|
%end;
|
|
100
106
|
%else %if &platform=SASVIYA %then %do;
|
|
101
|
-
filename _webout filesrvc parenturi="&SYS_JES_JOB_URI"
|
|
102
|
-
contenttype='
|
|
103
|
-
contentdisp="attachment; filename=&outname";
|
|
107
|
+
filename _webout filesrvc parenturi="&SYS_JES_JOB_URI"
|
|
108
|
+
contenttype='font/woff';
|
|
104
109
|
%end;
|
|
105
110
|
%end;
|
|
106
|
-
%else %if &contentype=
|
|
111
|
+
%else %if &contentype=XLSX %then %do;
|
|
107
112
|
%if &platform=SASMETA and &streamweb=1 %then %do;
|
|
108
113
|
data _null_;
|
|
109
|
-
rc=stpsrv_header('Content-type',
|
|
114
|
+
rc=stpsrv_header('Content-type',
|
|
115
|
+
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
|
|
110
116
|
rc=stpsrv_header('Content-disposition',"attachment; filename=&outname");
|
|
111
117
|
run;
|
|
112
118
|
%end;
|
|
113
119
|
%else %if &platform=SASVIYA %then %do;
|
|
114
|
-
filename _webout filesrvc parenturi="&SYS_JES_JOB_URI" name='_webout.
|
|
115
|
-
contenttype=
|
|
120
|
+
filename _webout filesrvc parenturi="&SYS_JES_JOB_URI" name='_webout.xls'
|
|
121
|
+
contenttype=
|
|
122
|
+
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
|
|
116
123
|
contentdisp="attachment; filename=&outname";
|
|
117
124
|
%end;
|
|
118
125
|
%end;
|
|
119
|
-
%else %if &contentype=
|
|
120
|
-
%if &platform=
|
|
121
|
-
|
|
122
|
-
|
|
126
|
+
%else %if &contentype=ZIP %then %do;
|
|
127
|
+
%if &platform=SASMETA and &streamweb=1 %then %do;
|
|
128
|
+
data _null_;
|
|
129
|
+
rc=stpsrv_header('Content-type','application/zip');
|
|
130
|
+
rc=stpsrv_header('Content-disposition',"attachment; filename=&outname");
|
|
131
|
+
run;
|
|
132
|
+
%end;
|
|
133
|
+
%else %if &platform=SASVIYA %then %do;
|
|
134
|
+
filename _webout filesrvc parenturi="&SYS_JES_JOB_URI" name='_webout.zip'
|
|
135
|
+
contenttype='application/zip'
|
|
136
|
+
contentdisp="attachment; filename=&outname";
|
|
123
137
|
%end;
|
|
124
|
-
%end;
|
|
125
|
-
%else %do;
|
|
126
|
-
%put %str(ERR)OR: Content Type &contenttype NOT SUPPORTED by &sysmacroname!;
|
|
127
|
-
%return;
|
|
128
138
|
%end;
|
|
129
139
|
|
|
130
140
|
%if &inref ne 0 %then %do;
|
package/package.json
CHANGED