@@ -143,24 +143,33 @@ export async function saveFile(
143143 options : {
144144 path : string ;
145145 param : Partial < Contents . IModel > ;
146+ registeredFileTypes : IRegisteredFileTypes ;
146147 }
147148) {
148- // const [fileType, fileMimeType, fileFormat] = getFileType(
149- // PathExt.extname(PathExt.basename(options.path)),
150- // options.registeredFileTypes
151- // );
152-
153- // const formattedBody = Private.formatBody(options.param, fileFormat, fileType, fileMimeType);
154- // const body: ReadonlyJSONObject = {
155- // content: formattedBody
156- // };
157-
158149 const response = await requestAPI < any > (
159150 'drives/' + driveName + '/' + options . path ,
160151 'PUT' ,
161152 {
162153 content : options . param . content
163154 }
164155 ) ;
165- console . log ( 'response: ' , response ) ;
156+
157+ const [ fileType , fileMimeType , fileFormat ] = getFileType (
158+ PathExt . extname ( PathExt . basename ( options . path ) ) ,
159+ options . registeredFileTypes
160+ ) ;
161+
162+ data = {
163+ name : PathExt . basename ( options . path ) ,
164+ path : PathExt . join ( driveName , options . path ) ,
165+ last_modified : response . data . last_modified ,
166+ created : response . data . last_modified ,
167+ content : response . data . content ,
168+ format : fileFormat as Contents . FileFormat ,
169+ mimetype : fileMimeType ,
170+ size : response . data . size ,
171+ writable : true ,
172+ type : fileType
173+ } ;
174+ return data ;
166175}
0 commit comments