Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
duiba-tiny-image-node
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
劳工
duiba-tiny-image-node
Commits
95110541
Commit
95110541
authored
Nov 06, 2021
by
rockyl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改3
parent
b8ef8b77
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
7 deletions
+7
-7
api.js
dist/api.js
+3
-3
api.js.map
dist/api.js.map
+1
-1
api.ts
src/api.ts
+3
-3
No files found.
dist/api.js
View file @
95110541
...
...
@@ -5,7 +5,7 @@
Object
.
defineProperty
(
exports
,
"__esModule"
,
{
value
:
true
});
const
logger_1
=
require
(
"./logger"
);
const
compress_1
=
require
(
"./compress"
);
const
ali_oss_duiba_1
=
require
(
"ali-oss-duiba"
);
//import {uploadFile} from 'ali-oss-duiba'
const
acceptTypes
=
[
'image/png'
,
'image/jpeg'
];
function
applyApi
(
server
)
{
server
.
get
(
'/info'
,
function
(
req
,
res
,
next
)
{
...
...
@@ -27,11 +27,11 @@ async function tinify(req, res, next) {
try
{
const
buffer
=
await
(
0
,
compress_1
.
compressImage
)(
file
.
path
,
type
);
if
(
cdnPath
)
{
const
name
=
await
(
0
,
ali_oss_duiba_1
.
uploadFile
)(
buffer
,
cdnPath
);
/*const name = await uploadFile(buffer, cdnPath)
res.send({
code: 0,
data: name
})
;
})
*/
}
else
{
res
.
sendRaw
(
buffer
,
{
...
...
dist/api.js.map
View file @
95110541
{"version":3,"file":"api.js","sourceR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at end of file
src/api.ts
View file @
95110541
...
...
@@ -4,7 +4,7 @@
import
logger
from
"./logger"
import
{
compressImage
}
from
"./compress"
import
{
uploadFile
}
from
'ali-oss-duiba'
//
import {uploadFile} from 'ali-oss-duiba'
const
acceptTypes
=
[
'image/png'
,
'image/jpeg'
]
...
...
@@ -31,11 +31,11 @@ async function tinify(req, res, next) {
try
{
const
buffer
=
await
compressImage
(
file
.
path
,
type
)
if
(
cdnPath
)
{
const
name
=
await
uploadFile
(
buffer
,
cdnPath
)
/*
const name = await uploadFile(buffer, cdnPath)
res.send({
code: 0,
data: name
})
})
*/
}
else
{
res
.
sendRaw
(
buffer
,
{
'Content-Type'
:
file
.
type
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment