MCPcopy Index your code
hub / github.com/scriptscat/scriptcat / list

Method list

packages/filesystem/onedrive/onedrive.ts:201–238  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

199 }
200
201 async list(): Promise<FileInfo[]> {
202 let { path } = this;
203 if (path === "/") {
204 path = "";
205 } else {
206 path = `:${path}:`;
207 }
208
209 const list: FileInfo[] = [];
210 let nextLink: string | undefined = `https://graph.microsoft.com/v1.0/me/drive/special/approot${path}/children`;
211 let iterationCount = 0;
212 const MAX_ITERATIONS = 100;
213
214 while (nextLink) {
215 iterationCount += 1;
216 if (iterationCount > MAX_ITERATIONS) {
217 throw new Error("OneDrive list pagination exceeded maximum iterations");
218 }
219 const data = await this.request(nextLink);
220
221 if (data.value) {
222 for (const val of data.value) {
223 list.push({
224 name: val.name,
225 path: this.path,
226 size: val.size,
227 digest: val.eTag,
228 createtime: new Date(val.createdDateTime).getTime(),
229 updatetime: new Date(val.lastModifiedDateTime).getTime(),
230 });
231 }
232 }
233
234 nextLink = data["@odata.nextLink"];
235 }
236
237 return list;
238 }
239
240 getDirUrl(): Promise<string> {
241 throw new Error("Method not implemented.");

Callers 1

verifyMethod · 0.95

Calls 2

requestMethod · 0.95
pushMethod · 0.80

Tested by

no test coverage detected