Tutorial by Examples: ar

This uses the Dropbox Python SDK to get the user's account information from the Dropbox API. import dropbox dbx = dropbox.Dropbox("<ACCESS_TOKEN>") dbx.users_get_current_account() <ACCESS_TOKEN> should be replaced with the access token.
This uses the SwiftyDropbox library to share a folder, handling every error case: Dropbox.authorizedClient!.sharing.shareFolder(path: "/folder_path").response { response, error in if let result = response { print("response: \(result)") } else if let callError ...
curl -X POST https://api.dropboxapi.com/2/sharing/share_folder \ --header "Authorization: Bearer <ACCESS_TOKEN>" \ --header "Content-Type: application/json" \ --data "{\"path\": \"/folder_path\",\"member_policy\&q...
curl -X POST https://api.dropboxapi.com/2/sharing/add_folder_member \ --header "Authorization: Bearer <ACCESS_TOKEN>" \ --header "Content-Type: application/json" \ --data "{\"shared_folder_id\": \"<SHARED_FOLDER_ID\",\"members...
let toInvite = [Sharing.AddMember(member: Sharing.MemberSelector.Email("<EMAIL_ADDRESS_TO_INVITE>"))] Dropbox.authorizedClient!.sharing.addFolderMember(sharedFolderId: "<SHARED_FOLDER_ID>", members: toInvite).response { response, error in if (response != nil...
Dropbox.authorizedClient!.files.listFolder(path: "").response { response, error in print("*** List folder ***") if let result = response { print("Folder contents:") for entry in result.entries { print(entry.name) if ...
// List folder Dropbox.authorizedClient!.files.listFolder(path: "/nonexistantpath").response { response, error in print("*** List folder ***") if let result = response { print("Folder contents:") for entry in result.entries { pr...
Dropbox.authorizedClient!.files.getMetadata(path: "/test.jpg", includeMediaInfo: true).response { response, error in if let result = response as? Files.FileMetadata { print(result.name) if result.mediaInfo != nil { switch result.mediaInfo! as Files.Med...
This uses the Dropbox Python SDK to create a shared link for a folder: import dropbox dbx = dropbox.Dropbox("<ACCESS_TOKEN>") shared_link_metadata = dbx.sharing_create_shared_link_with_settings("/Testing") print shared_link_metadata.url <ACCESS_TOKEN> should be...
curl -X POST https://api.dropboxapi.com/2/sharing/list_shared_links \ --header "Authorization: Bearer <ACCESS_TOKEN>" \ --header "Content-Type: application/json" \ --data "{\"path\": \"/test.txt\", \"direct_only\": true}&quo...
Dropbox.authorizedClient!.sharing.createSharedLink(path: "/test.txt").response({ response, error in if let link = response { print(link.url) } else { print(error!) } })
curl -X POST https://api.dropboxapi.com/2/sharing/create_shared_link_with_settings \ --header "Authorization: Bearer <ACCESS_TOKEN>" \ --header "Content-Type: application/json" \ --data "{\"path\": \"/Prime_Numbers.txt\",\"settin...
The JSON.parse() method parses a string as JSON and returns a JavaScript primitive, array or object: const array = JSON.parse('[1, 2, "c", "d", {"e": false}]'); console.log(array); // logs: [1, 2, "c", "d", {e: false}]
A replacer function can be used to filter or transform values being serialized. const userRecords = [ {name: "Joe", points: 14.9, level: 31.5}, {name: "Jane", points: 35.5, level: 74.4}, {name: "Jacob", points: 18.5, level: 41.2}, {name: "Jessie",...
A reviver function can be used to filter or transform the value being parsed. 5.1 var jsonString = '[{"name":"John","score":51},{"name":"Jack","score":17}]'; var data = JSON.parse(jsonString, function reviver(key, value) { return ke...
JavaScript has two primary ways to represent binary data in the browser. ArrayBuffers/TypedArrays contain mutable (though still fixed-length) binary data which you can directly manipulate. Blobs contain immutable binary data which can only be accessed through the asynchronous File interface. Conver...
DataViews provide methods to read and write individual values from an ArrayBuffer, instead of viewing the entire thing as an array of a single type. Here we set two bytes individually then interpret them together as a 16-bit unsigned integer, first big-endian then little-endian. var buffer = new Ar...
var data = 'iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACN' + 'byblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHx' + 'gljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg=='; var characters = atob(data); var array = new Uint8Array(characters.length); for (var i = 0; i < characters.length; i++) { array[i] ...
TypedArrays are a set of types providing different views into fixed-length mutable binary ArrayBuffers. For the most part, they act like Arrays that coerce all assigned values to a given numeric type. You can pass an ArrayBuffer instance to a TypedArray constructor to create a new view of its data. ...
5.1 When you take a reference to a method (a property which is a function) in JavaScript, it usually doesn't remember the object it was originally attached to. If the method needs to refer to that object as this it won't be able to, and calling it will probably cause a crash. You can use the .bind...

Page 10 of 218