Skip to content

Commit 30179c7

Browse files
author
Maya Shavin
committed
chore(docs): update embedded link in url-docs
1 parent 8bde3ed commit 30179c7

File tree

8 files changed

+128
-3
lines changed

8 files changed

+128
-3
lines changed

docs/url-docs/content/en/setup.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ setConfig({
3838
})
3939
```
4040

41-
See [Options]() section for all available options to initialize Cloudinary builder.
41+
See [Options](/options) section for all available options to initialize Cloudinary builder.
4242

4343
And that's it 🎉!
4444

45-
Now you can start [building optimized delivery urls]() for your images and videos with Cloudinary.
45+
Now you can start [building optimized delivery urls](/usage/buildUrl) for your images and videos with Cloudinary.
4646

docs/url-docs/content/en/usage/buildUrl.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ const url = buildImageUrl('example', {
6969

7070
To fetch a remote image using Cloudinary, you can set `cloud.storageType` to `fetch`.
7171

72-
See [Fetch Remote example]() for more details.
72+
See [Fetch Remote example](/examples/advanced#display-a-remote-image-via-cloudinary) for more details.
7373

7474
</alert>
7575

packages/uploader/README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# `uploader`
2+
3+
> TODO: description
4+
5+
## Usage
6+
7+
```
8+
const uploader = require('uploader');
9+
10+
// TODO: DEMONSTRATE API
11+
```
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
'use strict';
2+
3+
const uploader = require('..');
4+
5+
describe('uploader', () => {
6+
it('needs tests');
7+
});

packages/uploader/lib/constants.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
const UPLOAD_PREFIX = "https://api.cloudinary.com";

packages/uploader/lib/index.ts

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
2+
3+
export const upload = async (file, { cloud, options }) => {
4+
if (!file) {
5+
throw new Error('file is required!')
6+
}
7+
8+
if (!cloud || !cloud.cloudName) {
9+
throw new Error('cloud.cloudName is required!')
10+
}
11+
12+
const resourceType = options.resourceType || 'image'
13+
14+
const path = `${UPLOAD_PREFIX}/v1_1/${cloud.cloudName}/${resourceType}/upload`
15+
16+
17+
}
18+
19+
function random_public_id() {
20+
return crypto.randomBytes(12).toString('base64').replace(/[^a-z0-9]/g, "");
21+
}
22+
23+
exports.upload = function upload(file, callback, options = {}) {
24+
return call_api("upload", callback, options, function () {
25+
let params = build_upload_params(options);
26+
return isRemoteUrl(file) ? [params, { file: file }] : [params, {}, file];
27+
});
28+
};
29+
30+
exports.unsigned_upload = function unsigned_upload(file, upload_preset, callback, options = {}) {
31+
return exports.upload(file, callback, merge(options, {
32+
unsigned: true,
33+
upload_preset: upload_preset
34+
}));
35+
};
36+
37+
exports.upload_large = function upload_large(path, callback, options = {}) {
38+
if ((path != null) && isRemoteUrl(path)) {
39+
// upload a remote file
40+
return exports.upload(path, callback, options);
41+
}
42+
if (path != null && !options.filename) {
43+
options.filename = path.split(/(\\|\/)/g).pop().replace(/\.[^/.]+$/, "");
44+
}
45+
return exports.upload_chunked(path, callback, extend({
46+
resource_type: 'raw'
47+
}, options));
48+
};
49+
50+
exports.explicit = function explicit(public_id, callback, options = {}) {
51+
return call_api("explicit", callback, options, function () {
52+
return utils.build_explicit_api_params(public_id, options);
53+
});
54+
};
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
export const clearBlank = () => {}
2+
3+
export const getRequestParams = () => {
4+
5+
}
6+
7+
export const createSignature = ({ params, apiSecret }: { params: string[], apiSecret: string }) => {
8+
9+
}

packages/uploader/package.json

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
{
2+
"name": "cloudinary-media-uploader",
3+
"version": "0.0.0",
4+
"description": "Uploader for Cloudinary images and videos",
5+
"keywords": [
6+
"upload",
7+
"uploader",
8+
"cloudinary",
9+
"images",
10+
"videos",
11+
"image",
12+
"optimization",
13+
"video",
14+
"cloudinary-plugins",
15+
"node",
16+
"javascript"
17+
],
18+
"author": "Maya Shavin <maya@cloudinary.com>",
19+
"homepage": "https://github.com/mayashavin/cloudinary-api/tree/master/packages/uploader#readme",
20+
"license": "MIT",
21+
"main": "dist/index.js",
22+
"types": "dist/index.d.ts",
23+
"directories": {
24+
"lib": "lib",
25+
"test": "__tests__"
26+
},
27+
"files": [
28+
"dist"
29+
],
30+
"repository": {
31+
"type": "git",
32+
"url": "git+https://github.com/mayashavin/cloudinary-api.git"
33+
},
34+
"scripts": {
35+
"test": "echo \"Error: run tests from root\" && exit 1"
36+
},
37+
"bugs": {
38+
"url": "https://github.com/mayashavin/cloudinary-api/issues"
39+
},
40+
"dependencies": {
41+
"@types/jest": "^26.0.15"
42+
}
43+
}

0 commit comments

Comments
 (0)