Skip to content

Instantly share code, notes, and snippets.

@addy
Created February 1, 2023 05:57
Show Gist options
  • Save addy/ba7ce5b69d3c2f3677021af213880510 to your computer and use it in GitHub Desktop.
Save addy/ba7ce5b69d3c2f3677021af213880510 to your computer and use it in GitHub Desktop.
samplePart.ts
const getIdentity = async () =>
await ArcGISIdentityManager.signIn({
username,
password,
});
const auth = await getIdentity();
const file = createReadStream('./test.zip');
const item: ICreateItemResponse = await createItem({
item: {
title: 'Hello World',
type: 'Shapefile',
},
authentication: auth,
multipart: true,
filename: 'test.zip',
async: true,
overwrite: true,
});
// Note: You can add params: { f: 'text' } to see the HTML response
const part = await addItemPart({
id: item.id,
file,
partNum: 1,
authentication: auth,
});
const commit = await commitItemUpload({
item: { title: 'Hello World', type: 'Shapefile' },
id: part.id,
authentication: auth,
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment